闂備浇銆€閸嬫捇鏌熼婊冾暭妞ゃ儻鎷� (0) +1 闂佽崵濮嶅鍡楊伓 (0) +1 闂傚倸饪存禍鐑藉箯閿燂拷 (0) +1
闂備浇銆€閸嬫捇鏌熼婊冾暭妞ゃ儲鍨块弻鐔衡偓娑櫭慨鍥р攽椤曞棙瀚�闂備礁鎼悮顐﹀磿閸愯鑰块柛娑欐綑缂佲晠鏌熼婊冾暭妞ゃ儻鎷�>>
0

正在阅读:MDI应用中的单实例(singleton)窗口MDI应用中的单实例(singleton)窗口

2004-06-25 09:53 出处:CSDN 作者:turnmissile [翻译] 责任编辑:linjixiong

  下面的代码片断假设你的多文档应用程序中包含一个toolbar。当你点击toolBarButton1 按钮时,将会创建并显示一个 Patients 子窗口。下面的代码在单机事件时发生。



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
        {

 


察看评论详细内容 我要发表评论
作者笔名 简短内容 发表时间
:

键盘也能翻页,试试“← →”键

相关文章

关注我们

最新资讯离线随时看 聊天吐槽赢奖品
闂備礁缍婂ḿ褔顢栭崱妞绘敠闁逞屽墴閹鎷呴崨濠備淮濠碘槅鍋撻幏锟�闂備焦鎮堕崕鎶藉磻濞戙垹鏄ラ悘鐐板嫎娴滄粓鏌涢锝嗙闁告棑鎷�