C# 主窗按鈕的權限控制


   // 子表單啟動或關閉事件
        this .MdiChildActivate  +=   new  EventHandler(FMzMain_MdiChildActivate);

  private   void  FMzMain_MdiChildActivate( object  sender, EventArgs e)
        {
            
// 判斷是否有子窗體並且是否是當前窗體(當關閉時,當前窗體為空)
             if  ( this .MdiChildren.Length  >   0   &&   this .ActiveMdiChild  !=   null )
            {
                CheckButtonOperateEnable();
            }
            
else
            {
                CheckButtonOperateDisalbe();
            }
        }

         ///   <summary>
        
///  開啟排列視窗按鈕
        
///  scott 20070829
        
///   </summary>
         public   void  CheckButtonOperateEnable()
        {
            
// 啟用排列視窗 scott 20070829
            tsmArrangeWdw.Enabled  =   true ;
        }
        
///   <summary>
        
///  關閉排列視窗按鈕
        
///  scott 20070829
        
///   </summary>
         public   void  CheckButtonOperateDisalbe()
        {
            
// 禁用排列視窗 scott 20070829
            tsmArrangeWdw.Enabled  =   false ;       
        }


你可能感兴趣的:(控制)