如何:创建钢笔

此示例创建一个 Pen 对象。

示例

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

可靠编程

使用完消耗系统资源的对象(例如 Pen 对象)后,应对它们调用 Dispose

另请参阅