다음을 통해 공유


ExtendedProperty.Data 속성

업데이트: 2007년 11월

ExtendedProperty 개체의 데이터를 가져오거나 설정합니다.

네임스페이스:  Microsoft.Ink
어셈블리:  Microsoft.Ink(Microsoft.Ink.dll)

구문

‘선언
Public Property Data As Object
‘사용 방법
Dim instance As ExtendedProperty
Dim value As Object

value = instance.Data

instance.Data = value
public Object Data { get; set; }
public:
property Object^ Data {
    Object^ get ();
    void set (Object^ value);
}
/** @property */
public Object get_Data()
/** @property */
public  void set_Data(Object value)
public function get Data () : Object
public function set Data (value : Object)

속성 값

형식: System.Object
ExtendedProperty 개체의 데이터입니다.

예외

예외 상황
ArgumentException

Data가 다음 형식 중 하나로 설정되지 않은 경우

Char

Char 배열

Byte

Byte 배열

Int16

Int16 배열

UInt16

UInt16 배열

Int32

Int32 배열

UInt32

UInt32 배열

Int64

Int64 배열

UInt64

UInt64 배열

Single

Single 배열

Double

Double 배열

DateTime

DateTime 배열

Boolean

Boolean 배열

String

Decimal

Decimal 배열

설명

데이터는 Stroke 개체를 만든 시간 또는 날짜 등과 같이 개체에 설정할 수 없는 정보로 구성되어 있습니다.

예제

이 예제에서는 CursorDownStroke 이벤트에 대한 알림을 신청하여 사용자가 스트로크를 만드는 데 걸리는 시간을 계산하는 방법을 보여 줍니다.

스트로크가 시작될 때 CursorDown 이벤트가 발생합니다. Stroke 개체의 ExtendedProperties 컬렉션에 현재 시간이 저장됩니다.

Private Sub mInkObject_CursorDown(ByVal sender As Object, ByVal e As InkCollectorCursorDownEventArgs)
    ' add extended property indicating the time the stroke started
    ' STROKE_START_GUID is class level string via GUID generator
    e.Stroke.ExtendedProperties.Add(New Guid(STROKE_START_GUID), DateTime.Now)
End Sub
private void mInkObject_CursorDown(object sender, InkCollectorCursorDownEventArgs e)
{
    // add extended property indicating the time the stroke started
    // STROKE_START_GUID is class level string via GUID generator
    e.Stroke.ExtendedProperties.Add(new Guid(STROKE_START_GUID), DateTime.Now);
}

스트로크가 완성되면 Stroke 이벤트가 발생합니다. Stroke 개체의 ExtendedProperties 컬렉션에서 시작 시간을 검색하여 경과 시간을 계산하는 데 사용합니다.

Private Sub mInkObject_Stroke1(ByVal sender As Object, ByVal e As InkCollectorStrokeEventArgs)
    ' check to see if extended property for start time exists
    ' Attempting to access an extended property that hasn't been created throws an exception
    ' STROKE_START_GUID is class level string via GUID generator
    If (e.Stroke.ExtendedProperties.DoesPropertyExist(New Guid(STROKE_START_GUID))) Then

        Dim startTime As DateTime = DirectCast(e.Stroke.ExtendedProperties(New Guid(STROKE_START_GUID)).Data, DateTime)
        Dim endTime As DateTime = DateTime.Now
        Dim span As TimeSpan = New TimeSpan(endTime.Ticks - startTime.Ticks)

        ' add extended property indicating the time the stroke ended
        ' STROKE_END_GUID is class level string via GUID generator
        e.Stroke.ExtendedProperties.Add(New Guid(STROKE_END_GUID), endTime)

        ' display the number of seconds in creating this stroke
        Me.statusLabelStrokeTime.Text = span.TotalSeconds.ToString()
    End If
End Sub
private void mInkObject_Stroke1(object sender, InkCollectorStrokeEventArgs e)
{
    // check to see if extended property for start time exists
    // Attempting to access an extended property that hasn't been created throws an exception
    // STROKE_START_GUID is class level string via GUID generator
    if (e.Stroke.ExtendedProperties.DoesPropertyExist(new Guid(STROKE_START_GUID)))
    {
        DateTime startTime = (DateTime)e.Stroke.ExtendedProperties[new Guid(STROKE_START_GUID)].Data;
        DateTime endTime = DateTime.Now;
        TimeSpan span = new TimeSpan(endTime.Ticks - startTime.Ticks);

        // add extended property indicating the time the stroke ended
        // STROKE_END_GUID is class level string via GUID generator
        e.Stroke.ExtendedProperties.Add(new Guid(STROKE_END_GUID), endTime);

        // display the number of seconds in creating this stroke
        this.statusLabelStrokeTime.Text = span.TotalSeconds.ToString();
    }
}

플랫폼

Windows Vista

.NET Framework 및 .NET Compact Framework에서 모든 플랫폼의 전체 버전을 지원하지는 않습니다. 지원되는 버전의 목록을 보려면 .NET Framework 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

3.0에서 지원

참고 항목

참조

ExtendedProperty 클래스

ExtendedProperty 멤버

Microsoft.Ink 네임스페이스

DrawingAttributes.ExtendedProperties

ExtendedProperties

Stroke.ExtendedProperties