public DropDownButtonToolbarItem(IClickAction action, IconSize iconSize) : base() { IDropDownAction dropAction = (IDropDownAction)action; _fakeButton = new FakeToolstripButton(this); base.DropDownButtonWidth = 15; _action = action; _actionEnabledChangedHandler = new EventHandler(OnActionEnabledChanged); _actionVisibleChangedHandler = new EventHandler(OnActionVisibleChanged); _actionAvailableChangedHandler = new EventHandler(OnActionAvailableChanged); _actionLabelChangedHandler = new EventHandler(OnActionLabelChanged); _actionTooltipChangedHandler = new EventHandler(OnActionTooltipChanged); _actionIconSetChangedHandler = new EventHandler(OnActionIconSetChanged); _actionCheckedChangedHandler = new EventHandler(OnActionCheckedChanged); _action.EnabledChanged += _actionEnabledChangedHandler; _action.VisibleChanged += _actionVisibleChangedHandler; _action.AvailableChanged += _actionAvailableChangedHandler; _action.LabelChanged += _actionLabelChangedHandler; _action.TooltipChanged += _actionTooltipChangedHandler; _action.IconSetChanged += _actionIconSetChangedHandler; _action.CheckedChanged += _actionCheckedChangedHandler; _iconSize = iconSize; this.DropDown = new ContextMenuStrip(); this.DropDown.ImageScalingSize = StandardIconSizes.Small; this.DropDownOpening += new EventHandler(OnDropDownOpening); this.Text = _action.Label; this.Enabled = _action.Enabled; this.Visible = _action.Visible; SetTooltipText(); UpdateCheckedState(); UpdateVisibility(); UpdateEnablement(); UpdateIcon(); this.ButtonClick += delegate(object sender, EventArgs e) { _action.Click(); }; }
public DropDownButtonToolbarItem(IClickAction action, IconSize iconSize) : base() { IDropDownAction dropAction = (IDropDownAction) action; _fakeButton = new FakeToolstripButton(this); base.DropDownButtonWidth = 15; _action = action; _actionEnabledChangedHandler = new EventHandler(OnActionEnabledChanged); _actionVisibleChangedHandler = new EventHandler(OnActionVisibleChanged); _actionAvailableChangedHandler = new EventHandler(OnActionAvailableChanged); _actionLabelChangedHandler = new EventHandler(OnActionLabelChanged); _actionTooltipChangedHandler = new EventHandler(OnActionTooltipChanged); _actionIconSetChangedHandler = new EventHandler(OnActionIconSetChanged); _actionCheckedChangedHandler = new EventHandler(OnActionCheckedChanged); _action.EnabledChanged += _actionEnabledChangedHandler; _action.VisibleChanged += _actionVisibleChangedHandler; _action.AvailableChanged += _actionAvailableChangedHandler; _action.LabelChanged += _actionLabelChangedHandler; _action.TooltipChanged += _actionTooltipChangedHandler; _action.IconSetChanged += _actionIconSetChangedHandler; _action.CheckedChanged += _actionCheckedChangedHandler; _iconSize = iconSize; this.DropDown = new ContextMenuStrip(); this.DropDown.ImageScalingSize = StandardIconSizes.Small; this.DropDownOpening += new EventHandler(OnDropDownOpening); this.Text = _action.Label; this.Enabled = _action.Enabled; this.Visible = _action.Visible; SetTooltipText(); UpdateCheckedState(); UpdateVisibility(); UpdateEnablement(); UpdateIcon(); this.ButtonClick += delegate(object sender, EventArgs e) { _action.Click(); }; }