• <label id="pxtpz"><meter id="pxtpz"></meter></label>
      1. <span id="pxtpz"><optgroup id="pxtpz"></optgroup></span>

        當(dāng)前位置:雨林木風(fēng)下載站 > 技術(shù)開發(fā)教程 > 詳細頁面

        MDI應(yīng)用中的單案例(singleton)窗口

        MDI應(yīng)用中的單案例(singleton)窗口

        更新時間:2022-04-29 文章作者:未知 信息來源:網(wǎng)絡(luò) 閱讀次數(shù):

        下面的代碼片斷假設(shè)你的多文檔應(yīng)用程序中包含一個toolbar。當(dāng)你點擊toolBarButton1 按鈕時,將會創(chuàng)建并顯示一個 Patients 子窗口。下面的代碼在單機事件時發(fā)生。

        private void toolBar1_ButtonClick(object sender,
        System.Windows.Forms.ToolBarButtonClickEventArgs e)
        {
        // a flag to store if the child form is opened or not
        bool found = false;

        if (e.Button == toolBarButton1)
        {
        // get all of the MDI children in an array
        Form[] charr = this.MdiChildren;

        if (charr.Length == 0) // no child form is opened
        {
        Patients myPatients = new Patients();
        myPatients.MdiParent = this;
        // The StartPosition property is essential
        // for the location property to work
        myPatients.StartPosition = FormStartPosition.Manual;
        myPatients.Location = new Point(0,0);
        myPatients.Show();
        }
        else // child forms are opened
        {

        foreach (Form chform in charr)
        {
        if (chform.Name == "Patients")
        // one instance of the form is already opened
        {
        chform.Activate();
        found = true;
        break; // exit loop
        }
        else
        found = false; // make sure flag is set to
        // false if the form is not found
        }

        if (found == false)
        {
        Patients myPatients = new Patients();
        myPatients.MdiParent = this;
        // The StartPosition property is essential
        // for the location property to work
        myPatients.StartPosition = FormStartPosition.Manual;
        myPatients.Location = new Point(0,0);
        myPatients.Show();
        }
        }
        }
        }
        這樣,就實現(xiàn)了一個單窗口實例的解決方案。

        溫馨提示:喜歡本站的話,請收藏一下本站!

        本類教程下載

        系統(tǒng)下載排行

        主站蜘蛛池模板: 亚洲午夜久久久久久噜噜噜| 8888四色奇米在线观看免费看| 日本免费网址大全在线观看| 亚洲人成电影在线天堂| 巨胸喷奶水视频www免费视频| 亚洲一区日韩高清中文字幕亚洲 | 99re视频精品全部免费| 亚洲韩国精品无码一区二区三区| 久久久免费观成人影院| 国产国拍精品亚洲AV片| 国产啪精品视频网站免费尤物| 亚洲图片在线观看| 国产在线观看麻豆91精品免费| 久久精品国产亚洲av麻豆图片 | 亚洲 另类 无码 在线| 一区二区三区精品高清视频免费在线播放| 亚洲精品国产成人影院| 不卡视频免费在线观看| 久久精品夜色国产亚洲av| 中文字幕免费在线看线人| 中文字幕乱码亚洲精品一区| 蜜臀91精品国产免费观看| 美女露隐私全部免费直播| 国产亚洲?V无码?V男人的天堂 | 亚洲国产人成精品| 两性色午夜视频免费网| 久久精品国产亚洲AV无码偷窥| 岛国av无码免费无禁网站| 永久免费无码日韩视频| 亚洲精品网站在线观看你懂的| 日韩免费高清一级毛片在线| 亚洲精品视频免费| jlzzjlzz亚洲jzjzjz| 亚洲七七久久精品中文国产| 久久久久免费看成人影片| 亚洲国产成人综合精品| 亚洲日韩aⅴ在线视频| 免费看美女被靠到爽的视频| 中文字幕永久免费视频| 亚洲香蕉久久一区二区| 亚洲精品成人网久久久久久|