Share via


DrawingAttributes.ExtendedProperties Property

Gets the collection of application-defined data.

Namespace:  Microsoft.Ink
Assembly:  Microsoft.Ink (in Microsoft.Ink.dll)

Syntax

'Declaration
Public ReadOnly Property ExtendedProperties As ExtendedProperties
'Usage
Dim instance As DrawingAttributes 
Dim value As ExtendedProperties 

value = instance.ExtendedProperties
public ExtendedProperties ExtendedProperties { get; }
public:
property ExtendedProperties^ ExtendedProperties {
    ExtendedProperties^ get ();
}
public function get ExtendedProperties () : ExtendedProperties

Property Value

Type: Microsoft.Ink.ExtendedProperties
The collection of application-defined data.

Remarks

Applications can use the ExtendedProperties property to access the custom data that is stored in the DrawingAttributes object. This custom data is automatically serialized with the object.

Examples

This C# example contains an ink-enabled application that allows only three kinds of ink: a thin black pen, a thick blue marker, and a yellow highlighter. An array of DrawingAttributes objects, availableDrawingAttributes, is created for these three options, each of which is given an identifying GUID, drawingAttributesNameId. The InitializeDrawingAttributes method is called in the constructor, and the ChangeDrawingAttributes method is called whenever the user changes pens. The pen name is stored as an ExtendedProperty of the DrawingAttributes object. A Label, labelPenName, is used to display the pen name.

using Microsoft.Ink;
//...
    private InkOverlay theInkOverlay;
    private DrawingAttributes[] availableDrawingAttributes;
    private Guid drawingAttributesNameId;
    private System.Windows.Forms.Label labelPenName; 
//...
    private void InitializeDrawingAttributes()
    {
        availableDrawingAttributes = new DrawingAttributes[3];
        drawingAttributesNameId = Guid.NewGuid();

        // Thin pen
        availableDrawingAttributes[0] = new DrawingAttributes(new Pen(Color.Black, 1));
        availableDrawingAttributes[0].ExtendedProperties.Add(drawingAttributesNameId, "Thin pen");

        // Thick marker
        availableDrawingAttributes[1] = new DrawingAttributes(new Pen(Color.Blue, 200));
        availableDrawingAttributes[1].ExtendedProperties.Add(drawingAttributesNameId, "Thick marker");

        // Highlighter
        availableDrawingAttributes[2] = new DrawingAttributes(Color.Yellow);
        availableDrawingAttributes[2].Height = 800;
        availableDrawingAttributes[2].Width = 1;
        availableDrawingAttributes[2].PenTip = PenTip.Rectangle;
        availableDrawingAttributes[2].Transparency = 125;
        availableDrawingAttributes[2].ExtendedProperties.Add(drawingAttributesNameId, "Highlighter");
    }

    private void ChangeDrawingAttributes(int index)
    {
        // Set the default drawing attributes of the InkOverlay
        theInkOverlay.DefaultDrawingAttributes = availableDrawingAttributes[index];

        // Display the pen name that you are using
        labelPenName.Text = 
            (String)availableDrawingAttributes[index].ExtendedProperties[drawingAttributesNameId].Data;
    }

This Microsoft® Visual Basic® .NET example contains an ink-enabled application that allows only three kinds of ink: a thin black pen, a thick blue marker, and a yellow highlighter. An array of DrawingAttributes objects, availableDrawingAttributes, is created for these three options, each of which is given an identifying GUID, drawingAttributesNameId. The InitializeDrawingAttributes method is called in the constructor, and the ChangeDrawingAttributes method is called whenever the user changes pens. The pen name is stored as an ExtendedProperty of the DrawingAttributes object. A Label, labelPenName, is used to display the pen name.

Imports Microsoft.Ink
'...
Private WithEvents theInkOverlay As InkOverlay
Private availableDrawingAttributes As DrawingAttributes()
Private drawingAttributesNameId As Guid
Friend WithEvents LabelPenName As System.Windows.Forms.Label
'...
Private Sub InitializeDrawingAttributes()
    ReDim availableDrawingAttributes(2)
    drawingAttributesNameId = Guid.NewGuid()

    'Thin pen
    availableDrawingAttributes(0) = New DrawingAttributes(New Pen(Color.Black, 1))
    availableDrawingAttributes(0).ExtendedProperties.Add(drawingAttributesNameId, "Thin pen")

    'Thick marker
    availableDrawingAttributes(1) = New DrawingAttributes(New Pen(Color.Blue, 200))
    availableDrawingAttributes(1).ExtendedProperties.Add(drawingAttributesNameId, "Thick marker")

    'Highlighter
    availableDrawingAttributes(2) = New DrawingAttributes(Color.Yellow)
    availableDrawingAttributes(2).Height = 800
    availableDrawingAttributes(2).Width = 1
    availableDrawingAttributes(2).PenTip = PenTip.Rectangle
    availableDrawingAttributes(2).Transparency = 125
    availableDrawingAttributes(2).ExtendedProperties.Add(drawingAttributesNameId, "Highlighter")
End Sub

Private Sub ChangeDrawingAttributes(ByVal index As Integer)
    'Set the default drawing attributes of the InkOverlay
    theInkOverlay.DefaultDrawingAttributes = availableDrawingAttributes(index)

    'Display the pen name that you are using
    LabelPenName.Text = _
        availableDrawingAttributes(index).ExtendedProperties(drawingAttributesNameId).Data
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

ExtendedProperties

ExtendedProperty