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;       
        }
posted @ 2008-07-28 12:32  浪子の无悔  阅读(282)  评论(0编辑  收藏  举报