DrawingAttributes.Width Property

Microsoft Silverlight will reach end of support after October 2021. Learn more.

Gets or sets the width of the stylus that is used to draw a Stroke.

Namespace:  System.Windows.Ink
Assembly:  System.Windows (in System.Windows.dll)

Syntax

'Declaration
Public Property Width As Double
public double Width { get; set; }
<DrawingAttributes Width="double"/>

Property Value

Type: System.Double
The width of the stylus that is used to draw a Stroke. The default is 2 pixels.

Remarks

If you try to set the Width property to 0 pixels, it is changed to 2 pixels.

Examples

The following code example demonstrates how to set the Width property. This is part of a larger example available in DrawingAttributes class overview.

    'Set drawing attributes to simulate a highlighter
    Private Sub BtHighlighter_Click(ByVal sender As Object, ByVal e As EventArgs)
        MyDA.Width = 25
        MyDA.Height = 5
        MyDA.Color = Colors.Yellow
        MyDA.OutlineColor = Colors.Yellow
    End Sub

//Set drawing attributes to simulate a highlighter
private void BtHighlighter_Click(object sender, EventArgs e)
{
    MyDA.Width = 25;
    MyDA.Height = 5;
    MyDA.Color = Colors.Yellow;
    MyDA.OutlineColor = Colors.Yellow;
}

Version Information

Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

Platforms

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.