PenInputPanelMovingEventHandler 대리자
업데이트: 2007년 11월
PenInputPanel 개체의 PanelMoving 이벤트를 처리하는 메서드를 나타냅니다.
네임스페이스: Microsoft.Ink
어셈블리: Microsoft.Ink(Microsoft.Ink.dll)
구문
‘선언
Public Delegate Sub PenInputPanelMovingEventHandler ( _
sender As Object, _
e As PenInputPanelMovingEventArgs _
)
‘사용 방법
Dim instance As New PenInputPanelMovingEventHandler(AddressOf HandlerMethod)
public delegate void PenInputPanelMovingEventHandler(
Object sender,
PenInputPanelMovingEventArgs e
)
public delegate void PenInputPanelMovingEventHandler(
Object^ sender,
PenInputPanelMovingEventArgs^ e
)
/** @delegate */
public delegate void PenInputPanelMovingEventHandler(
Object sender,
PenInputPanelMovingEventArgs e
)
JScript에서는 대리자를 지원하지 않습니다.
매개 변수
- sender
형식: System.Object
이 이벤트의 소스 PenInputPanel 개체입니다.
- e
형식: Microsoft.Ink.PenInputPanelMovingEventArgs
이벤트 데이터가 들어 있는 PenInputPanelMovingEventArgs 개체입니다.
설명
PanelMoving 이벤트를 사용하면 Left 및 Top 매개 변수를 변경하여 펜 입력 패널의 위치를 변경할 수 있습니다.
경고
MoveTo 및 Refresh 메서드는 PenInputPanel 개체가 자동 위치 지정 코드를 호출하도록 합니다. 그러면 PanelMoving 이벤트가 발생합니다. 그러므로 PenInputPanelMovingEventHandler 대리자 내에서 이러한 메서드를 호출하면 무한 루프가 발생할 수 있습니다.
예제
이 C# 예제에서는 PenInputPanel 개체인 thePenInputPanel을 만들어 InkEdit 컨트롤인 theInkEdit에 연결합니다. 그런 다음 PanelMoving 이벤트 처리기 및 VisibleChanged 이벤트 처리기를 thePenInputPanel에 추가합니다. VisibleChanged 처리기에서 펜 입력 패널의 위치가 변경되어 PanelMoving 이벤트가 발생합니다. 이후 PanelMoving 처리기는 연결된 InkEdit 컨트롤의 텍스트를 펜 입력 패널의 새 화면 좌표가 들어 있는 문장으로 설정합니다.
[C#]
//...
// Delcare the PenInputPanel object
PenInputPanel thePenInputPanel;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
// Create and attach the new PenInputPanel to an InkEdit control.
thePenInputPanel = new PenInputPanel(theInkEdit);
// Add a PanelMoving event handler
thePenInputPanel.PanelMoving +=
new PenInputPanelMovingEventHandler(PanelMoving_Event);
// Add a VisibleChanged event handler
thePenInputPanel.VisibleChanged +=
new PenInputPanelVisibleChangedEventHandler(VisibleChanged_Event);
}
//...
public void PanelMoving_Event(object sender,
PenInputPanelMovingEventArgs e)
{
// Make sure the object that generated
// the event is a PenInputPanel object
if (sender is PenInputPanel)
{
PenInputPanel theSenderPanel = (PenInputPanel)sender;
theSenderPanel.AttachedEditControl.Text = "The panel has moved to ";
theSenderPanel.AttachedEditControl.Text += e.Left.ToString();
theSenderPanel.AttachedEditControl.Text += ", ";
theSenderPanel.AttachedEditControl.Text += e.Top.ToString();
}
}
public void VisibleChanged_Event(object sender,
PenInputPanelVisibleChangedEventArgs e)
{
// Make sure the object that generated
// the event is a PenInputPanel object
if (sender is PenInputPanel)
{
PenInputPanel theSenderPanel = (PenInputPanel)sender;
// If the panel has become visible...
if (e.NewVisibility)
{
// Move the pen input panel to screen position 100, 100
theSenderPanel.MoveTo(100, 100);
}
}
}
이 Microsoft® Visual Basic® .NET 예제에서는 PenInputPanel 개체인 thePenInputPanel을 만들어 InkEdit 컨트롤인 theInkEdit에 연결합니다. 그런 다음 PanelMoving 이벤트 처리기 및 VisibleChanged 이벤트 처리기를 thePenInputPanel에 추가합니다. VisibleChanged 처리기에서 펜 입력 패널의 위치가 변경되어 PanelMoving 이벤트가 발생합니다. 이후 PanelMoving 처리기는 연결된 InkEdit 컨트롤의 텍스트를 펜 입력 패널의 새 화면 좌표가 들어 있는 문장으로 설정합니다.
[Visual Basic]
'...
' Declare the PenInputPanel object
Dim thePenInputPanel As PenInputPanel
Public Sub New()
MyBase.New()
' Required for Windows Form Designer support
InitializeComponent();
' Create and attach the new PenInputPanel to an InkEdit control.
thePenInputPanel = New PenInputPanel(theInkEdit)
' Add a PanelMoving event handler
AddHandler thePenInputPanel.PanelMoving, _
AddressOf PanelMoving_Event
' Add a VisibleChanged event handler
AddHandler thePenInputPanel.VisibleChanged, _
AddressOf VisibleChanged_Event
End Sub 'New
'...
Public Sub PanelMoving_Event(sender As Object, e As _
PenInputPanelMovingEventArgs)
' Make sure the object that generated
' the event is a PenInputPanel object
If TypeOf sender Is PenInputPanel Then
Dim theSenderPanel As PenInputPanel = CType(sender, PenInputPanel)
theSenderPanel.AttachedEditControl.Text = "The panel has moved to "
theSenderPanel.AttachedEditControl.Text += e.Left.ToString
theSenderPanel.AttachedEditControl.Text += ", "
theSenderPanel.AttachedEditControl.Text += e.Top.ToString
End If
End Sub 'PanelMoving_Event
Public Sub VisibleChanged_Event(sender As Object, e As _
PenInputPanelVisibleChangedEventArgs)
' Make sure the object that generated
' the event is a PenInputPanel object
If TypeOf sender Is PenInputPanel Then
Dim theSenderPanel As PenInputPanel = CType(sender, PenInputPanel)
' If the panel has become visible...
If e.NewVisibility Then
' Move the pen input panel to screen position 100, 100
theSenderPanel.MoveTo(100, 100)
End If
End If
End Sub 'VisibleChanged_Event
플랫폼
Windows Vista
.NET Framework 및 .NET Compact Framework에서 모든 플랫폼의 전체 버전을 지원하지는 않습니다. 지원되는 버전의 목록을 보려면 .NET Framework 시스템 요구 사항을 참조하십시오.
버전 정보
.NET Framework
3.0에서 지원