共用方式為


Stroke.DrawingAttributes Property

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

Gets or sets the properties of the stroke, such as Height, Width, Color, or OutlineColor.

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

Syntax

'Declaration
Public Property DrawingAttributes As DrawingAttributes
public DrawingAttributes DrawingAttributes { get; set; }
<Stroke>
  <Stroke.DrawingAttributes>
    singleDrawingAttribute
  </Stroke.DrawingAttributes>
</Stroke>

XAML Values

  • singleDrawingAttribute
    A single DrawingAttributes object element. Typically this object element will also define attribute values for Height, Color, and so on.

Property Value

Type: System.Windows.Ink.DrawingAttributes
The DrawingAttributes of the stroke.

Remarks

DrawingAttributes is not a collection. It is a representative object that is used to set various properties of the object that is used in the stroke rendering. To set the DrawingAttributes property in XAML, you must use the property element syntax shown in the syntax and in the example.

Examples

The following code example demonstrates how to set the DrawingAttributes property. This is part of a larger example available in the 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.