public Stroke() { InitializeComponent(); draw = new Draw(this.Handle, API.CreatePen(API.PenStyle.PS_SOLID, Settings.Pen.Thickness, new API.COLORREF(Settings.Pen.Color.R, Settings.Pen.Color.G, Settings.Pen.Color.B))); this.Shown += Stroke_Shown; this.FormClosing += Stroke_FormClosing; MouseHook.MouseAction += MouseHook_MouseAction; Settings.Pen.PenChanged += Pen_PenChanged; API.AllowSetForegroundWindow((uint)Process.GetCurrentProcess().Id); }
private void Pen_PenChanged() { draw.Dispose(); GC.Collect(); draw = new Draw(this.Handle, API.CreatePen(API.PenStyle.PS_SOLID, Settings.Pen.Thickness, new API.COLORREF(Settings.Pen.Color.R, Settings.Pen.Color.G, Settings.Pen.Color.B))); }