PenInputPanel.InputFailed 事件
已取代。若在 PenInputPanel 物件能夠將使用者輸入插入附加的控制項之前,輸入焦點就已變更,便會發生這種情況。PenInputPanel 已被 Microsoft.Ink.TextInput 取代。
命名空間: Microsoft.Ink
組件: Microsoft.Ink (在 Microsoft.Ink.dll 中)
語法
'宣告
Public Event InputFailed As PenInputPanelInputFailedEventHandler
'用途
Dim instance As PenInputPanel
Dim handler As PenInputPanelInputFailedEventHandler
AddHandler instance.InputFailed, handler
public event PenInputPanelInputFailedEventHandler InputFailed
public:
event PenInputPanelInputFailedEventHandler^ InputFailed {
void add (PenInputPanelInputFailedEventHandler^ value);
void remove (PenInputPanelInputFailedEventHandler^ value);
}
/** @event */
public void add_InputFailed (PenInputPanelInputFailedEventHandler value)
/** @event */
public void remove_InputFailed (PenInputPanelInputFailedEventHandler value)
JScript 不支援事件。
備註
事件處理常式會收到 PenInputPanelInputFailedEventArgs 型別的引數,其中包含這個事件的相關資料。
若輸入焦點在使用者輸入插入附加的控制項之前就已變更,則會發生 InputFailed 事件。例如,如果使用者將「筆墨」輸入書寫板,然後在辨識器尚未完成之前點選另一個編輯控制項,便會引發這個事件。
透過使用傳遞至這個事件的視窗控制代碼,您就可以選擇在這個事件發生時手動插入文字。
重要
自 Microsoft® Windows® XP Tablet PC Edition 2005 起,InputFailed 事件不再適用。文字會固定在焦點變更之前插入。
安全性注意事項: |
---|
如果在部分信任的情況下使用,除了 PenInputPanel 所需的權限之外,這個事件還需要 SecurityPermissionFlag.AllFlags (英文) 權限。請參閱Security and Trust。 |
範例
這個 C# 範例會建立兩個 PenInputPanel 物件 (thePenInputPanel1 和 thePenInputPanel2),並且將它們附加至 TextBox (英文) 控制項 (textBox1 和 textBox2)。這個範例會將 PenInputPanelInputFailedEventHandler (InputFailed_Event) 加入至每一個 PenInputPanel 物件。在事件處理常式中,如果焦點已變更,則會藉由設定 Text (英文) 屬性,在前一個 TextBox (英文) 控制項中設定文字。
//...
// Declare PenInputPanel objects
PenInputPanel thePenInputPanel1;
PenInputPanel thePenInputPanel2;
public Form1()
{
// Required for Windows Form Designer support
InitializeComponent();
// Create, and attach new PenInputPanels to a TextBox controls.
thePenInputPanel1 = new PenInputPanel(textBox1);
thePenInputPanel2 = new PenInputPanel(textBox2);
// Add an InputFailed event handler to each PenInputPanel
thePenInputPanel1.InputFailed +=
new PenInputPanelInputFailedEventHandler(InputFailed_Event);
thePenInputPanel2.InputFailed +=
new PenInputPanelInputFailedEventHandler(InputFailed_Event);
}
//...
public void InputFailed_Event(object sender,
PenInputPanelInputFailedEventArgs e)
{
// Make sure the object that generated
// the event is a PenInputPanel object
if (sender is PenInputPanel)
{
PenInputPanel theSenderPanel = (PenInputPanel)sender;
// Set the text in the previous control
theSenderPanel.AttachedEditControl.Text += e.Text;
}
}
這個 Microsoft Visual Basic® .NET 範例會建立兩個 PenInputPanel 物件 (thePenInputPanel1 和 thePenInputPanel2),並且將它們附加至 TextBox (英文) 控制項 (textBox1 和 textBox2)。這個範例會將 PenInputPanelInputFailedEventHandler (InputFailed_Event) 加入至每一個 PenInputPanel 物件。在事件處理常式中,如果焦點已變更,則會藉由設定 Text (英文) 屬性,在前一個 TextBox (英文) 控制項中設定文字。
'...
' Declare the PenInputPanel objects
Dim thePenInputPanel1 As PenInputPanel
Dim thePenInputPanel2 As PenInputPanel
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
' Create and attach new PenInputPanels to a TextBox controls.
thePenInputPanel1 = New PenInputPanel(TextBox1)
thePenInputPanel2 = New PenInputPanel(TextBox2)
' Add an InputFailed event handler to each PenInputPanel
AddHandler thePenInputPanel1.InputFailed, AddressOf InputFailed_Event
AddHandler thePenInputPanel2.InputFailed, AddressOf InputFailed_Event
End Sub 'New
'...
Public Sub InputFailed_Event(ByVal sender As Object, ByVal e As _
PenInputPanelInputFailedEventArgs)
' Make sure the object that generated
' the event is a PenInputPanel object
If TypeOf sender Is PenInputPanel Then
Dim thePenInputPanel As PenInputPanel = CType(sender, PenInputPanel)
' Set the text in the previous control
thePenInputPanel.AttachedEditControl.Text += e.Text
End If
End Sub 'InputFailed_Event
平台
Windows Vista
.NET Framework 和 .NET Compact Framework 並不支援各種平台的所有版本。如需支援平台版本的相關資訊,請參閱 .NET Framework 系統需求。
版本資訊
.NET Framework
支援版本:3.0