private void DrawButton(SlotOverlay overlay, Graphics g) { Brush brush; if (Hovering == overlay) { brush = new SolidBrush(Color.FromArgb(170, overlay.Color)); } else { brush = new SolidBrush(Color.FromArgb(200, overlay.Color)); } switch (overlay.Shape) { case SlotShape.Rect: g.FillRectangle(brush, overlay.Metrics); break; case SlotShape.Rounded: DrawRoundRect(g, brush, overlay.Metrics, 4); break; case SlotShape.Circle: g.FillEllipse(brush, overlay.Metrics); break; } }
private void ControllerView_MouseDown(object sender, MouseEventArgs e) { previousSelectedItem = SelectedItem; foreach (var o in slotOverlays) { if (o.Metrics.Contains(e.Location)) { SelectedItem = o; return; } } SelectedItem = null; }
private void ControllerView_MouseMove(object sender, MouseEventArgs e) { foreach (var o in slotOverlays) { if (o.Metrics.Contains(e.Location)) { this.Cursor = Cursors.Hand; if (Hovering != o) { Hovering = o; Render(); } return; } } if (Hovering != null) { Hovering = null; Render(); } this.Cursor = Cursors.Default; }