René Nyffenegger's collection of things on the web
René Nyffenegger on Oracle - Most wanted - Feedback
 

GDI and .NET

using System;
using System.Windows.Forms;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing.Text;

public class GdiTest : Form {
   protected override void OnPaint(PaintEventArgs e) {
      Graphics g = e.Graphics;

      Brush      brush   = new SolidBrush(Color.Red);
      FontFamily fontFam = new FontFamily("Verdana");
      Font       font    = new Font(fontFam, 24, FontStyle.Regular, GraphicsUnit.Pixel); 
      PointF     point   = new PointF(50, 50);
      
      g.DrawString("Hello World!", font, brush, point);

      Color c = Color.FromArgb(128,Color.FromArgb(50,200,80));
      Pen pen = new Pen(c, 20);
      g.DrawLine( pen,  40, 40, 100, 100);
      g.DrawLine( pen, 100, 40,  40, 100);
   }

   public static void Main() {
      Application.Run(new GdiTest());
   }
}