-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRoundIndicator.cs
More file actions
32 lines (28 loc) · 915 Bytes
/
Copy pathRoundIndicator.cs
File metadata and controls
32 lines (28 loc) · 915 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using System.Collections.Generic;
using System.Drawing.Drawing2D;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace MouseGile
{
public class RoundIndicator : Control
{
public Color IndicatorColor { get; set; } = Color.Red;
public RoundIndicator()
{
this.DoubleBuffered = true; // reduce flicker
this.ResizeRedraw = true; // redraw on resize
this.Width = this.Height = 30; // default size
}
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
using (Brush brush = new SolidBrush(IndicatorColor))
{
// Only fill, no border
e.Graphics.FillEllipse(brush, 0, 0, this.Width - 1, this.Height - 1);
}
}
}
}