Share via


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);
}
public function get Width () : float 
public function set Width (value : float)

Property Value

Type: System.Single
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.

Examples

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 7, Windows Vista, Windows Server 2008 R2, Windows Server 2008

The .NET Framework and .NET Compact Framework do not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Version Information

.NET Framework

Supported in: 3.0

See Also

Reference

DrawingAttributes Class

DrawingAttributes Members

Microsoft.Ink Namespace

DrawingAttributes.PenTip

DrawingAttributes.Height

DrawingAttributes.IgnorePressure