Пример #1
0
 private void FLERForm_MouseLeave(object sender, EventArgs e)
 {
     if (hover?.Visible == true && hover?.MouseLeave(e) == true)
     {
         Invalidate(hover.Bounds);
     }
     hover = null;
 }
Пример #2
0
 private void FLERForm_MouseDown(object sender, MouseEventArgs e)
 {
     if (hover?.Visible == true && hover?.MouseDown(e) == true)
     {
         Invalidate(hover.Bounds);
     }
     selected = hover;
 }
Пример #3
0
 private void FLERForm_MouseUp(object sender, MouseEventArgs e)
 {
     if (hover?.Visible == true && hover?.MouseUp(e) == true)
     {
         Invalidate(hover.Bounds);
     }
     if (hover?.Visible == true && selected == hover && selected?.Click(e) == true)
     {
         Invalidate(selected.Bounds);
     }
     selected = null;
 }
Пример #4
0
        private void FLERForm_MouseMove(object sender, MouseEventArgs e)
        {
            if (hover?.Visible == true && hover?.MouseMove(e) == true)
            {
                Invalidate(hover.Bounds);
            }

            FLERControl next    = null;
            Point       pointer = PointToClient(Cursor.Position);

            if (new Rectangle(Point.Empty, ClientRectangle.Size).Contains(pointer))
            {
                if (selected == null)
                {
                    foreach (FLERControl control in FLERControls)
                    {
                        if (control.Visible && control.Bounds.Contains(pointer))
                        {
                            next = control;
                            break;
                        }
                    }
                }
                else
                {
                    if (selected.Visible && selected.Bounds.Contains(pointer))
                    {
                        next = selected;
                    }
                }
            }

            if (next != hover)
            {
                if (hover?.Visible == true && hover?.MouseLeave(e) == true)
                {
                    Invalidate(hover.Bounds);
                }
                if (next?.MouseEnter(e) == true)
                {
                    Invalidate(next.Bounds);
                }
            }

            hover  = next;
            Cursor = hover?.Cursor ?? Cursors.Default;
        }