public static void Rectangle(Color color, int x, int y, int width, int height, int thickness) { IntPtr dC = WinAPI.GetDC(IntPtr.Zero); Pen pen = new Pen(color, (float)thickness); using (Graphics graphics = Graphics.FromHdc(dC)) { graphics.DrawRectangle(pen, new Rectangle(x, y, width, height)); } WinAPI.ReleaseDC(IntPtr.Zero, dC); }
public static void Circle(Color color, int x, int y, int size, int thickness) { IntPtr dC = WinAPI.GetDC(IntPtr.Zero); Pen pen = new Pen(color, (float)thickness); using (Graphics graphics = Graphics.FromHdc(dC)) { graphics.DrawEllipse(pen, x - size / 2, y - size / 2, size, size); } WinAPI.ReleaseDC(IntPtr.Zero, dC); }
public static void String(string str, int x, int y, Color color, int fontSize) { IntPtr dC = WinAPI.GetDC(IntPtr.Zero); Brush brush = new SolidBrush(color); Font font = new Font("Arial", (float)fontSize); using (Graphics graphics = Graphics.FromHdc(dC)) { graphics.DrawString(str, font, brush, new Point(x, y)); } WinAPI.ReleaseDC(IntPtr.Zero, dC); }