Share via


如何:创建钢笔

此示例创建一个 Pen 对象。

示例

Dim myPen As System.Drawing.Pen
myPen = New System.Drawing.Pen(System.Drawing.Color.Tomato)
System.Drawing.Pen myPen;
myPen = new System.Drawing.Pen(System.Drawing.Color.Tomato);
System::Drawing::Pen^ myPen;
myPen = gcnew System::Drawing::Pen(System::Drawing::Color::Tomato);

可靠编程

当使用完需要消耗系统资源的对象(如 Pen 对象)后,应对其调用 Dispose

请参见

参考

Pen

概念

GDI+ 中的笔、直线和矩形

其他资源

图形编程入门