Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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);
        }
Ejemplo n.º 3
0
        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);
        }