Compartir a través de


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 ();
}
/** @property */
public ExtendedProperties get_ExtendedProperties ()
public function get ExtendedProperties () : ExtendedProperties
Not applicable.

Property Value

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.

Example

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 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
ExtendedProperties
ExtendedProperty