コード例 #1
0
ファイル: ButtonClient.cs プロジェクト: bhouston/ExoEngine3D
        public ButtonClient(CommandButton commandButton)
        {
            _commandButton          = commandButton;
            _commandButton.Changed += new CommandControlChangedEventHandler(this.ClientUpdate);
            this.Dock = DockStyle.None;
            Debug.Assert(_commandButton.Icon != null, "CommandButton has null icon: " + _commandButton.GetType());
            _bitmap = new Bitmap(16, 16, PixelFormat.Format32bppArgb);
            BitmapUtils.CopyBitmapData(_commandButton.Icon.ToBitmap(), _bitmap);
            BitmapUtils.SetTransparency(_bitmap, Color.Magenta);
            _bitmapDark       = ExoControlUtils.CreateDisabledBitmap(_bitmap, 192, 64);
            _bitmapUnselected = ExoControlUtils.CreateContrastedBitmap(_bitmap, 0.8f);

            this.Size    = new Size(22, 22);
            this.Layout += new LayoutEventHandler(this.OnLayout);
        }
コード例 #2
0
        public bool Execute(Type type, params object[] list)
        {
            CommandControl cc = Find(type);

            if (cc == null)
            {
                throw new ArgumentException("no CommandControl of name '" + type + "' found", "type");
            }
            if (!(cc is CommandButton))
            {
                throw new ArgumentException("CommandControl '" + type + "' is not a CommandButton", "type");
            }

            CommandButton cb = (CommandButton)cc;

            cb.Update();
            if (cb.Enabled == true)
            {
                cb.Params = list;
                //BugTracking.SetWatch( "CommandControls.LastExecute", cb );
                return(cb.Execute());
            }
            return(false);
        }
コード例 #3
0
 public MenuItemClient(CommandButton commandButton)
 {
     _commandButton          = commandButton;
     _commandButton.Changed += new CommandControlChangedEventHandler(this.ClientUpdate);
 }