语言

UICuesEventArgs.ChangeFocus 属性

定义

获取一个值,该值指示焦点提示的状态是否已更改。

public:
 property bool ChangeFocus { bool get(); };
public bool ChangeFocus { get; }
member this.ChangeFocus : bool
Public ReadOnly Property ChangeFocus As Boolean

属性值

true 如果焦点提示的状态已更改,则为否则,为 false.

示例

下面的代码示例演示了此成员的使用。 在此示例中,事件处理程序报告事件的发生情况 Control.ChangeUICues 。 此报告可帮助你了解事件发生的时间,并可以帮助你进行调试。 若要报告多个事件或频繁发生的事件,请考虑替换MessageBox.ShowConsole.WriteLine或将消息追加到多行TextBox。

若要运行示例代码,请将其粘贴到包含继承自 Control的类型实例的项目(如 Button 或 ComboBox)。 然后为实例 Control1 命名,并确保事件处理程序与 Control.ChangeUICues 该事件相关联。

private void Control1_ChangeUICues(Object sender, UICuesEventArgs e) {

System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "ShowFocus", e.ShowFocus );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ShowKeyboard", e.ShowKeyboard );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ChangeFocus", e.ChangeFocus );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ChangeKeyboard", e.ChangeKeyboard );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Changed", e.Changed );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "ChangeUICues Event" );
}
Private Sub Control1_ChangeUICues(sender as Object, e as UICuesEventArgs) _ 
     Handles Control1.ChangeUICues

    Dim messageBoxVB as New System.Text.StringBuilder()
    messageBoxVB.AppendFormat("{0} = {1}", "ShowFocus", e.ShowFocus)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "ShowKeyboard", e.ShowKeyboard)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "ChangeFocus", e.ChangeFocus)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "ChangeKeyboard", e.ChangeKeyboard)
    messageBoxVB.AppendLine()
    messageBoxVB.AppendFormat("{0} = {1}", "Changed", e.Changed)
    messageBoxVB.AppendLine()
    MessageBox.Show(messageBoxVB.ToString(),"ChangeUICues Event")

End Sub

适用于

另请参阅