<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    blogjava's web log

    blogjava's web log
    ...

    // 得到路徑
    ???????????? string ?strPath = System.IO.Directory.GetCurrentDirectory();
    // 分割
    string ?str1 = " text1,text2,text3,text4 "
    string []?stri = str1.Split( new ? char [] { ' ' } );

    // 啟動一個程序

    using ?System;
    using ?System.Drawing;
    using ?System.Collections;
    using ?System.ComponentModel;
    using ?System.Windows.Forms;
    using ?System.Data;
    using ?System.Diagnostics;
    using ?System.Reflection;
    using ?System.Runtime.InteropServices;

    ????????
    /// ? <summary>
    ????????
    /// ?應用程序的主入口點。
    ????????
    /// ? </summary>

    ????????[STAThread]
    ????????
    static ? void ?Main()?
    ????????
    {
    ????????????
    // Get?the?running?instance.
    ????????????Process?instance? = ?RunningInstance();
    ????????????
    if ?(instance? == ? null )
    ????????????
    {
    ????????????????
    // 新實例
    ????????????????Application.Run( new ?Form1());
    ????????????}

    ????????????
    else
    ????????????
    {
    ????????????????
    // 相同的實例,并將窗口置前
    ????????????????HandleRunningInstance(instance);
    ????????}

    ????}


    public ? static ?Process?RunningInstance()
    {
    ????Process?current?
    = ?Process.GetCurrentProcess();
    ????Process[]?processes?
    = ?Process.GetProcessesByName?(current.ProcessName);
    ????
    // 查找相同名的進程
    ???? foreach ?(Process?process? in ?processes)
    ????
    {
    ????
    // 忽略當前線程
    ???? if ?(process.Id? != ?current.Id)
    ????
    {
    ????
    // 確認相同名的進程運行位置是否相同
    ???? if ?(Assembly.GetExecutingAssembly().Location.Replace( " / " ,? " \\ " )? == current.MainModule.FileName)
    {
    ????
    // 返回相同名進程
    ???? return ?process;
    }

    }

    }

    ????
    // 沒有其它進程,返回空值
    ???? return ? null ;
    }


    ?
    public ? static ? void ?HandleRunningInstance(Process?instance)
    ?
    {
    ?
    // 確認窗口是最小化或最大化
    ?ShowWindowAsync?(instance.MainWindowHandle?,?WS_SHOWNORMAL);

    ?
    // 將窗口置前
    ?SetForegroundWindow?(instance.MainWindowHandle);
    ?}


    ?[DllImport(
    " User32.dll " )]?

    private ? static ? extern ? bool ?ShowWindowAsync(IntPtr?hWnd,? int ?cmdShow);
    ?[DllImport(
    " User32.dll " )]? private ? static ? extern ? bool ?SetForegroundWindow(IntPtr?hWnd);
    ?
    private ? const ? int ?WS_SHOWNORMAL? = ? 1 ;

    ????????
    private ? void ?Form1_Load( object ?sender,?System.EventArgs?e)
    ????????
    {
    ????????
    ????????}

    ?}
    posted @ 2006-05-28 14:56 record java and net 閱讀(403) | 評論 (0)編輯 收藏

    [Serializable]
    ????
    public?class?MyObject?
    ????
    {
    ????????
    public?int?n1?=?0;
    ????????
    public?int?n2?=?0;
    ????????
    public?String?str?=?null;
    ????}

    using?System;
    using?System.Drawing;
    using?System.Collections;
    using?System.ComponentModel;
    using?System.Windows.Forms;
    using?System.Data;
    using?System.IO?;
    using?System.Runtime?.Serialization?.Formatters?.Binary?;
    using?System.Runtime?.Serialization?;

    //系列化
    private?void?button1_Click(object?sender,?System.EventArgs?e)
    ????????
    {
    ????????????MyObject?obj?
    =?new?MyObject();
    ????????????obj.n1?
    =?1;
    ????????????obj.n2?
    =?24;
    ????????????obj.str?
    =?"Some?String";
    ????????????IFormatter?formatter?
    =?new?BinaryFormatter();
    ????????????Stream?stream?
    =?new?FileStream("MyFile.bin",?FileMode.Create,?FileAccess.Write,?FileShare.None);
    ????????????formatter.Serialize(stream,?obj);
    ????????????stream.Close();

    ????????}

    //反。。。。。。
    ????????private?void?button2_Click(object?sender,?System.EventArgs?e)
    ????????
    {
    ????????????IFormatter?formatter?
    =?new?BinaryFormatter();
    ????????????Stream?stream?
    =?new?FileStream("MyFile.bin",?FileMode.Open,?FileAccess.Read,?FileShare.Read);
    ????????????MyObject?obj?
    =?(MyObject)?formatter.Deserialize(stream);
    ????????????stream.Close();
    ????????????MessageBox.Show?(obj.n1.ToString?()?);

    ????????}
    posted @ 2006-05-28 14:25 record java and net 閱讀(322) | 評論 (0)編輯 收藏
         摘要: pull模式 ???????? protected ? void ?Page_Load( object ?sender,?System.EventArgs?e)???????? {???????????? // ?在...  閱讀全文
    posted @ 2006-05-28 14:12 record java and net 閱讀(481) | 評論 (0)編輯 收藏
         摘要: 使用DataRelation類創建關系并利用父/子關系讀取數據示例void?Page_Load(object?sender,?System.EventArgs?e)????????????{????????????????//?連接字符串和?SQL?語句????????????????string?ConnString?=?System.Configuration.ConfigurationSet...  閱讀全文
    posted @ 2006-05-27 18:07 record java and net 閱讀(737) | 評論 (2)編輯 收藏
         摘要: 思路:建個模版文件,再用C#讀此文件,把里面的標記替換掉。。  閱讀全文
    posted @ 2006-05-27 17:32 record java and net 閱讀(327) | 評論 (0)編輯 收藏
    僅列出標題
    共31頁: First 上一頁 17 18 19 20 21 22 23 24 25 下一頁 Last 

    導航

    常用鏈接

    留言簿(44)

    新聞檔案

    2.動態語言

    3.工具箱

    9.文檔教程

    友情鏈接

    搜索

    最新評論

    主站蜘蛛池模板: 亚洲AV无码专区在线电影成人| 久久亚洲高清观看| 亚洲va乱码一区二区三区| 三级网站免费观看| 国产精品亚洲αv天堂无码| 免费国产高清毛不卡片基地| 国产黄色片在线免费观看| 亚洲精品无AMM毛片| 免费看少妇作爱视频| 亚洲中文字幕无码久久2020| 狼友av永久网站免费观看| 亚洲av无码无线在线观看| 国产在线19禁免费观看国产 | 久久久久无码专区亚洲av| 亚洲精品美女久久久久99小说| 色费女人18女人毛片免费视频 | 久久亚洲高清综合| 国产V片在线播放免费无码 | 国产亚洲自拍一区| 十八禁视频在线观看免费无码无遮挡骂过 | 337p日本欧洲亚洲大胆色噜噜| 亚洲黄色免费在线观看| 亚洲国产成人va在线观看网址| 成年女性特黄午夜视频免费看 | free哆拍拍免费永久视频 | 亚洲码国产精品高潮在线| 亚洲视屏在线观看| 国产成人高清亚洲一区久久| 亚洲国产精品13p| 在线涩涩免费观看国产精品 | 亚洲熟妇无码八V在线播放| avtt亚洲天堂| 国产白丝无码免费视频| 亚洲av片不卡无码久久| 国产中文字幕免费观看| 日本免费人成网ww555在线| 亚洲人成毛片线播放| 亚洲国产精品第一区二区三区| 亚洲视频一区在线| 成人av片无码免费天天看| 亚洲精品国产电影午夜|