protected override void OnMouseDown(MouseEventArgs e) { base.OnMouseDown(e); ToolBar2xButtonBase button = PressedButton(e.X, e.Y); if (null != button) { this.pressedButton = button; this.Invalidate(); this.Update(); } }
protected override void OnMouseUp(MouseEventArgs e) { base.OnMouseUp(e); ToolBar2xButtonBase button = PressedButton(e.X, e.Y); if (null != button) { if (button == this.pressedButton) { button.OnClick(); } } this.pressedButton = null; this.Invalidate(); this.Update(); }
private void InitializeToolBar() { ToolBar2xButtonBase buttonNew = new ToolBar2xButtonBase(MyResources.GetIcon("new.ico"), this.toolBar2x1); ToolBar2xButtonBase buttonDelete = new ToolBar2xButtonBase(FileIcons.GetSystemIcon(131, false), this.toolBar2x1); ToolBar2xButtonBase buttonProperties = new ToolBar2xButtonBase(FileIcons.GetSystemIcon(134, false), this.toolBar2x1); ToolBar2xSeparator buttonSpace = new ToolBar2xSeparator(); ToolBar2xButtonBase buttonUp = new ToolBar2xButtonBase(FileIcons.GetSystemIcon(146, false), this.toolBar2x1); this.buttonPrint = new ToolBar2xButtonBase(FileIcons.GetSystemIcon(16, false), this.toolBar2x1); this.buttonPrint.Click += new EventHandler(PrintClick); this.toolBar2x1.Buttons.Add(buttonNew); this.toolBar2x1.Buttons.Add(buttonDelete); this.toolBar2x1.Buttons.Add(buttonProperties); this.toolBar2x1.Buttons.Add(buttonSpace); this.toolBar2x1.Buttons.Add(buttonUp); this.toolBar2x1.Buttons.Add(this.buttonPrint); buttonNew.Click += new EventHandler(buttonNew_Click); buttonProperties.Click += new EventHandler(buttonProperties_Click); buttonDelete.Click += new EventHandler(buttonDelete_Click); buttonUp.Click += new EventHandler(MoveUpButtonClick); }