/// <summary> /// Raises the <see cref="E:System.Windows.Forms.Control.MouseUp" /> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.Forms.MouseEventArgs" /> that contains the event data.</param> protected override void OnMouseUp(MouseEventArgs e) { Rectangle rectangle = new Rectangle(checked (this.Width - 14), 2, 10, 10); if (!rectangle.Contains(e.Location)) { this.CurrentState = ZeroitMetroExpander.MouseState.None; } else { if (this._State != ZeroitMetroExpander.eState.None) { this.Size = this._NoneSize; this._State = ZeroitMetroExpander.eState.None; } else { this.Size = this._ExpandedSize; this._State = ZeroitMetroExpander.eState.Expanded; } this.CurrentState = ZeroitMetroExpander.MouseState.Over; } this.Invalidate(); base.OnMouseUp(e); }
/// <summary> /// Initializes a new instance of the <see cref="ZeroitMetroExpander" /> class. /// </summary> public ZeroitMetroExpander() { this.CurrentState = ZeroitMetroExpander.MouseState.None; this._State = ZeroitMetroExpander.eState.None; this.DrawInterectArea = false; this.Size = new System.Drawing.Size(150, 15); this._NoneSize = new System.Drawing.Size(150, 15); this._ExpandedSize = new System.Drawing.Size(300, 150); this.Font = new System.Drawing.Font("Segoe UI", 9f); this.SetStyle(ControlStyles.UserPaint | ControlStyles.ResizeRedraw | ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true); this.UpdateStyles(); }
/// <summary> /// Raises the <see cref="E:System.Windows.Forms.Control.MouseDown" /> event. /// </summary> /// <param name="e">A <see cref="T:System.Windows.Forms.MouseEventArgs" /> that contains the event data.</param> protected override void OnMouseDown(MouseEventArgs e) { Rectangle rectangle = new Rectangle(2, 2, Width, Height); if (!rectangle.Contains(e.Location)) { this.CurrentState = ZeroitMetroExpander.MouseState.None; } else { this.CurrentState = ZeroitMetroExpander.MouseState.Over; } this.Invalidate(); base.OnMouseDown(e); }
/// <summary> /// Raises the <see cref="E:System.Windows.Forms.Control.MouseLeave" /> event. /// </summary> /// <param name="e">An <see cref="T:System.EventArgs" /> that contains the event data.</param> protected override void OnMouseLeave(EventArgs e) { this.CurrentState = ZeroitMetroExpander.MouseState.None; this.Invalidate(); base.OnMouseLeave(e); }