示例#1
0
文件: Command.cs 项目: perryiv/cadkit
 /// <summary>
 /// Update the menu button.
 /// </summary>
 private void _updateMenuButton()
 {
     try
     {
         // Do not call this.ToolButton! We do not want to make one.
         if (true == this.HasMenuButton)
         {
             System.Windows.Forms.ToolStrip owner = this.MenuButton.Owner;
             if (null != owner)
             {
                 if (true == owner.InvokeRequired)
                 {
                     owner.BeginInvoke(new VoidReturnZeroArgumentsDelegate(this._updateMenuButton));
                 }
                 else
                 {
                     bool state = this._isChecked();
                     this.MenuButton.CheckState = (state) ? System.Windows.Forms.CheckState.Checked : System.Windows.Forms.CheckState.Unchecked;
                     this.MenuButton.Checked    = state;
                     this.MenuButton.Invalidate();
                 }
             }
         }
     }
     catch (System.Exception e)
     {
         System.Console.WriteLine("Error 2674442530: {0}", e.Message);
     }
 }