다음을 통해 공유


InkPicture.CursorButtonUp 이벤트

업데이트: 2007년 11월

InkPicture 컨트롤이 올라가 있는 커서 단추를 감지하면 발생합니다.

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

구문

‘선언
Public Event CursorButtonUp As InkCollectorCursorButtonUpEventHandler
‘사용 방법
Dim instance As InkPicture
Dim handler As InkCollectorCursorButtonUpEventHandler

AddHandler instance.CursorButtonUp, handler
public event InkCollectorCursorButtonUpEventHandler CursorButtonUp
public:
 event InkCollectorCursorButtonUpEventHandler^ CursorButtonUp {
    void add (InkCollectorCursorButtonUpEventHandler^ value);
    void remove (InkCollectorCursorButtonUpEventHandler^ value);
}
/** @event */
public void add_CursorButtonUp (InkCollectorCursorButtonUpEventHandler value)
/** @event */
public void remove_CursorButtonUp (InkCollectorCursorButtonUpEventHandler value)
JScript에서는 이벤트를 지원하지 않습니다.

설명

사용자가 스트로크를 완성하고 디지타이저에서 펜을 떼면 펜 팁의 단추가 올라갑니다. 단추를 누르지 않은 경우 펜의 단추는 올라가 있습니다.

이벤트 처리기는 이 이벤트에 대한 데이터가 들어 있는 InkCollectorCursorButtonUpEventArgs 형식의 인수를 받습니다.

InkCollectorCursorButtonUpEventHandler 대리자를 만들 때는 이벤트를 처리할 메서드를 식별합니다. 이벤트를 이벤트 처리기와 연결하려면 대리자의 인스턴스를 해당 이벤트에 추가합니다. 대리자를 제거하지 않는 경우 이벤트가 발생할 때마다 이벤트 처리기가 호출됩니다. 이벤트 관심도는 성능상의 이유로 기본적으로 해제되어 있지만 이벤트 처리기를 추가하면 자동으로 설정됩니다.

마우스 오른쪽 단추를 놓으면 두 CursorButtonUp 이벤트(오른쪽 단추 해제에 하나, 왼쪽 단추 해제에 하나)를 받게 됩니다.

예제

다음 예제에서는 마우스로 잉크를 그릴 때 잉크 자체와 다른 색을 사용하여 잉크 포인터를 표시하기 위해 CursorInRange 이벤트, CursorButtonDown 이벤트 및 CursorButtonUp 이벤트에 대한 알림을 신청하는 방법을 보여 줍니다.

CursorInRange 이벤트가 발생하면 InkPicture 개체가 해당 Cursor 개체와 처음으로 접촉했는지 확인합니다. 확인에 성공하면 DrawingAttributes 속성에 DefaultDrawingAttributes 속성의 복제본이 할당됩니다. 이렇게 하면 이후에 DrawingAttributes 속성에 액세스할 때 null 참조 예외가 throw되지 않습니다. 마우스가 사용되고 있으면 잉크 색이 빨간색으로 설정됩니다.

Private Sub mInkObject_CursorInRange(ByVal sender As Object, ByVal e As InkCollectorCursorInRangeEventArgs)
    Const MOUSE_CURSOR_ID As Integer = 1
    If e.NewCursor Then
        ' mInkObject can be InkCollector, InkOverlay, or InkPicture
        e.Cursor.DrawingAttributes = mInkObject.DefaultDrawingAttributes.Clone()
        ' if this cursor is the mouse, we'll set color to red
        If (MOUSE_CURSOR_ID = e.Cursor.Id) Then
            e.Cursor.DrawingAttributes.Color = Color.Red
        End If

    End If
End Sub
private void mInkObject_CursorInRange(object sender, InkCollectorCursorInRangeEventArgs e)
{
    const int MOUSE_CURSOR_ID = 1;

    if (e.NewCursor)
    {
        // mInkObject can be InkCollector, InkOverlay, or InkPicture
        e.Cursor.DrawingAttributes = mInkObject.DefaultDrawingAttributes.Clone();
        // if this cursor is the mouse, we'll set color to red
        if (MOUSE_CURSOR_ID == e.Cursor.Id)
        {
            e.Cursor.DrawingAttributes.Color = Color.Red;
        }
    }
}

CursorButtonDown 이벤트가 발생하면 이벤트에 제공된 Cursor 개체가 마우스인지 확인합니다. 확인에 성공하면 Color() 속성이 파란색으로 설정됩니다.

Private Sub mInkObject_CursorButtonDown(ByVal sender As Object, ByVal e As InkCollectorCursorButtonDownEventArgs)
    Const MOUSE_CURSOR_ID As Integer = 1
    If (MOUSE_CURSOR_ID = e.Cursor.Id) Then
        e.Cursor.DrawingAttributes.Color = Color.Blue
    End If
End Sub
private void mInkObject_CursorButtonDown(object sender, InkCollectorCursorButtonDownEventArgs e)
{
    const int MOUSE_CURSOR_ID = 1;

    if (MOUSE_CURSOR_ID == e.Cursor.Id)
    {
        e.Cursor.DrawingAttributes.Color = Color.Blue;
    }

}

CursorButtonUp 이벤트가 발생하면 이벤트에 제공된 Cursor 개체가 마우스인지 확인합니다. 확인에 성공하면 Color() 속성이 빨간색으로 설정됩니다.

Private Sub mInkObject_CursorButtonUp(ByVal sender As Object, ByVal e As InkCollectorCursorButtonUpEventArgs)
    Const MOUSE_CURSOR_ID As Integer = 1
    If (MOUSE_CURSOR_ID = e.Cursor.Id) Then
        e.Cursor.DrawingAttributes.Color = Color.Red
    End If
End Sub
private void mInkObject_CursorButtonUp(object sender, InkCollectorCursorButtonUpEventArgs e)
{
    const int MOUSE_CURSOR_ID = 1;

    if (MOUSE_CURSOR_ID == e.Cursor.Id)
    {
        e.Cursor.DrawingAttributes.Color = Color.Red;
    }
}

플랫폼

Windows Vista

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

버전 정보

.NET Framework

3.0에서 지원

참고 항목

참조

InkPicture 클래스

InkPicture 멤버

Microsoft.Ink 네임스페이스

Cursor

CursorButton

InkCollectorCursorButtonUpEventArgs

InkCollectorCursorButtonUpEventHandler

InkPicture.CursorButtonDown

InkPicture.OnCursorButtonUp