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 オブジェクト。
解説
Left パラメータおよび Top パラメータを変更することにより、ペン入力パネルの位置を変更するには、PanelMoving イベントを使用します。
![]() |
---|
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