DrawingAttributes.Width Property
Gets or sets the y-axis dimension, or width, of the pen tip when drawing ink.
Namespace: Microsoft.Ink
Assembly: Microsoft.Ink (in microsoft.ink.dll)
Syntax
'Declaration
Public Property Width As Single
'Usage
Dim instance As DrawingAttributes
Dim value As Single
value = instance.Width
instance.Width = value
public float Width { get; set; }
public:
property float Width {
float get ();
void set (float value);
}
/** @property */
public float get_Width ()
/** @property */
public void set_Width (float value)
public function get Width () : float
public function set Width (value : float)
Not applicable.
Property Value
The y-axis dimension, or width, of the pen tip when drawing ink.
Value |
Meaning |
---|---|
53 |
The width of the pen tip is 53 HIMETRIC units. |
Single |
Value representing the width of the pen tip, in HIMETRIC units. |
Remarks
The Width property is in HIMETRIC units.
If the tablet reports pen pressure (if the IgnorePressure property is false), the actual width of the ink varies depending on the amount of pressure applied to the drawing surface. When maximum pressure is applied, the width is 150% of the value of the Width property. When minimum pressure is applied, the width is 50% of the value of the Width property. By default, pressure from the pen is reported. To specify that pressure should not be reported (that the width of ink does not change), set the IgnorePressure property to true.
Precision is limited to one one-thousandth of a HIMETRIC unit (three digits to the right of the decimal point). For example, if you specify a value of 2.0006, the most precise measurement is 2.001.
Example
This C# example creates event handlers for menu items that change the Width property of a DrawingAttributes object.
using Microsoft.Ink;
//...
private System.Windows.Forms.MenuItem menuInkWidthThin;
private System.Windows.Forms.MenuItem menuInkWidthThick;
private InkCollector theInkCollector;
private System.Windows.Forms.MenuItem checkedWidth;
//...
private void menuInkWidthThin_Click(
object sender, System.EventArgs e)
{
checkedWidth.Checked = false;
// Set the width about one pixel wide in HIMETRIC
theInkCollector.DefaultDrawingAttributes.Width = 30;
checkedWidth = menuInkWidthThin;
checkedWidth.Checked = true;
Refresh();
}
private void menuInkWidthThick_Click(
object sender, System.EventArgs e)
{
checkedWidth.Checked = false;
// Set the width about ten pixels wide in HIMETRIC
theInkCollector.DefaultDrawingAttributes.Width = 300;
checkedWidth = menuInkWidthThick;
checkedWidth.Checked = true;
Refresh();
}
This Microsoft® Visual Basic® .NET example creates event handlers for menu items that change the Width property of a DrawingAttributes object.
Imports Microsoft.Ink
'...
Dim MenuInkWidthThin As System.Windows.Forms.MenuItem
Dim MenuInkWidthThick As System.Windows.Forms.MenuItem
Dim CheckedWidth As System.Windows.Forms.MenuItem
Dim theInkCollector As InkCollector
'...
Private Sub MenuInkWidthThin_Click( _
ByVal sender As Object, ByVal e As System.EventArgs)
CheckedWidth.Checked = False
'Set the width about one pixel wide in HIMETRIC
theInkCollector.DefaultDrawingAttributes.Width = 30
CheckedWidth = MenuInkWidthThin
CheckedWidth.Checked = True
Refresh()
End Sub
Private Sub MenuInkWidthThick_Click( _
ByVal sender As Object, ByVal e As System.EventArgs)
CheckedWidth.Checked = False
theInkCollector.DefaultDrawingAttributes.Width = 300
CheckedWidth = MenuInkWidthThick
CheckedWidth.Checked = True
Refresh()
End Sub
Platforms
Windows 98, Windows Server 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.
Version Information
.NET Framework
Supported in: 3.0
See Also
Reference
DrawingAttributes Class
DrawingAttributes Members
Microsoft.Ink Namespace
DrawingAttributes.PenTip
DrawingAttributes.Height
DrawingAttributes.IgnorePressure