DrawingAttributes.ExtendedProperties - свойство
Обновлен: Ноябрь 2007
Gets the collection of application-defined data.
Пространство имен: Microsoft.Ink
Сборка: Microsoft.Ink (в Microsoft.Ink.dll)
Синтаксис
'Декларация
Public ReadOnly Property ExtendedProperties As ExtendedProperties
'Применение
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
Значение свойства
Тип: Microsoft.Ink.ExtendedProperties
The collection of application-defined data.
Заметки
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.
Примеры
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
Платформы
Windows Vista
Среды .NET Framework и .NET Compact Framework поддерживают не все версии каждой платформы. Поддерживаемые версии перечислены в разделе Требования к системе для .NET Framework.
Сведения о версии
.NET Framework
Поддерживается в версии: 3.0