DrawingAttributes 构造函数 (Pen)
使用指定 Pen 对象的颜色和宽度初始化 DrawingAttributes 类的新实例。
命名空间: Microsoft.Ink
程序集: Microsoft.Ink(在 Microsoft.Ink.dll 中)
语法
声明
Public Sub New ( _
pen As Pen _
)
用法
Dim pen As Pen
Dim instance As New DrawingAttributes(pen)
public DrawingAttributes(
Pen pen
)
public:
DrawingAttributes(
Pen^ pen
)
public DrawingAttributes(
Pen pen
)
public function DrawingAttributes(
pen : Pen
)
参数
- pen
类型:System.Drawing.Pen
从中获得 DrawingAttributes 对象的笔颜色和宽度的 Pen 对象。
备注
修改笔画的绘制属性时,请尝试重复使用某个现有的 DrawingAttributes 对象,而不是每次均创建一个新的对象。创建新的 DrawingAttributes 对象所分配的内存在 DrawingAttributes 对象生存期之后仍随 Ink 对象保留。
示例
此 C# 示例初始化 DrawingAttributes 类的新实例 theDrawingAttributes,并且 Color 和 Width 属性设置为笔 thickRedPen 的这些属性。
Pen thickRedPen = new Pen(Color.Red, 200);
DrawingAttributes theDrawingAttributes = new DrawingAttributes(thickRedPen);
此 Microsoft Visual Basic .NET 示例初始化 DrawingAttributes 类的新实例 theDrawingAttributes,并且 Width 和 Width 属性设置为笔 thickRedPen 的这些属性。
Dim thickRedPen As New Pen(Color.Red, 200)
Dim theDrawingAttributes As New DrawingAttributes(thickRedPen)
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 并不是对每个平台的所有版本都提供支持。有关支持的版本的列表,请参见.NET Framework 系统要求。
版本信息
.NET Framework
受以下版本支持:3.0