示例
C#復制
public void DrawString(){
System.Drawing.Graphics formGraphics = this.CreateGraphics(); string drawString = "Sample Text";
System.Drawing.Font drawFont = new System.Drawing.Font("Arial", 16);
System.Drawing.SolidBrush drawBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black); float x = 150.0F; float y = 50.0F;
System.Drawing.StringFormat drawFormat = new System.Drawing.StringFormat();
formGraphics.DrawString(drawString, drawFont, drawBrush, x, y, drawFormat);
drawFont.Dispose();
drawBrush.Dispose();
formGraphics.Dispose();
}