다음을 통해 공유


InkCollectorStrokeEventArgs.Stroke 속성

업데이트: 2007년 11월

Stroke 이벤트를 발생시킨 수집된 Stroke 개체를 가져옵니다.

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

구문

‘선언
Public ReadOnly Property Stroke As Stroke
‘사용 방법
Dim instance As InkCollectorStrokeEventArgs
Dim value As Stroke

value = instance.Stroke
public Stroke Stroke { get; }
public:
property Stroke^ Stroke {
    Stroke^ get ();
}
/** @property */
public Stroke get_Stroke()
public function get Stroke () : Stroke

속성 값

형식: Microsoft.Ink.Stroke
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에서 지원

참고 항목

참조

InkCollectorStrokeEventArgs 클래스

InkCollectorStrokeEventArgs 멤버

Microsoft.Ink 네임스페이스

InkCollector.Stroke