示例#1
0
        /// <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);
        }
示例#2
0
 /// <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();
 }
示例#3
0
        /// <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);
        }
示例#4
0
 /// <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);
 }