protected override void OnMouseUp(MouseEventArgs e) { if (selectedButton == null) { return; } Capture = false; isInside = false; if (!RedrawAfterEvent) { UpdateButton(selectedButton); } if (selectedButton == HitTest(e.X, e.Y)) { if (SipButtonClick != null) { SipButtonClick(this, new SipEventArgs(selectedButton.Key)); } } if (RedrawAfterEvent) { UpdateButton(selectedButton); } selectedButton = null; }
/// <summary> /// /// </summary> /// <param name="button"></param> public void UpdateButton(SipButton button) { if (button == null) { throw new ArgumentNullException("button"); } using (var g = CreateGraphics()) { button.Draw(g, (selectedButton == button) && isInside); } }
protected override void OnMouseDown(MouseEventArgs e) { Focus(); selectedButton = HitTest(e.X, e.Y); if (selectedButton == null) { return; } isInside = true; Capture = true; UpdateButton(selectedButton); }