private bool ControlBoxContains(Point p) { if (this.ControlBoxContains(this.CloseButton, p, this._closeRect) || this.ControlBoxContains(this.MaximizeButton, p, this._maximizeRect) || this.ControlBoxContains(this.MinimizeButton, p, this._minimizeRect)) { return true; } this._mouseIsOver = OurBounds.Client; if (this._mouseAction == MouseAction.Hover) { this.Invalidate(); } this._mouseAction = MouseAction.None; return false; }
private bool ControlBoxContains(IOurFormButtonBase buttonBase, Point p, Rectangle r) { // Might have an issue with this... if (!this.IsVisible(buttonBase) || !r.Contains(p)) { return false; } this._mouseIsOver = buttonBase.ButtonBounds; this._mouseAction = buttonBase.State != OurFormButtonStates.Disabled /* * The extra Trenary is required otherwise when the mouse is clicked * is the _mouseAction would always of been set to MouseAction.Hover */ ? this._mouseAction == MouseAction.Click ? this._mouseAction : MouseAction.Hover : MouseAction.None; return true; }
protected override void OnMouseLeave(EventArgs e) { base.OnMouseLeave(e); this._mouseIsOver = OurBounds.OffClient; this._mouseAction = MouseAction.None; this.Invalidate(); }