简单的Graphics.DrawString方法
PaintHello.cs
1 using System;
2 using System.Drawing;
3 using System.Windows.Forms;
4
5 class PaintHello
6 {
7 public static void Main()
8 {
9 Form form = new Form();
10 form.Text = "Paint Hello";
11 form.BackColor = Color.White;
12 form.Paint += new PaintEventHandler(MyPaintHandler);
13
14 Application.Run(form);
15 }
16 static void MyPaintHandler(object objSender, PaintEventArgs pea)
17 {
18 Form form = (Form)objSender;
19 Graphics grfx = pea.Graphics;
20
21 grfx.DrawString("Hello, world!", form.Font, Brushes.Black, 0, 0);
22 }
23 }