代码之家  ›  专栏  ›  技术社区  ›  ChrisW

Windows窗体自定义控件:焦点和光标键UIPermissionWindow.AllWindows所有窗口

  •  0
  • ChrisW  · 技术社区  · 14 年前

    我想为Windows窗体编写一个自定义控件(文本编辑器),其中应包括以下功能:

    • 查看所有键盘输入(包括光标键),当它有焦点时,
    • 可以在半信任的环境中运行 UIPermissionWindow.SafeTopLevelWindows (即不需要 UIPermissionWindow.AllWindows )

    一些我可能想用的方法,比如 Control.Focus() Control.InInputKey() .

    在不使用这些方法的情况下,是否有其他方法来获取/实现功能?

    1 回复  |  直到 14 年前
        1
  •  1
  •   vulkanino    14 年前
    Public Class UserControl1
        Inherits TextBox
    
        Private Sub UserControl1_GotFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.GotFocus
    
        End Sub
    
        Private Sub UserControl1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
            Debug.WriteLine("downed")
            Debug.WriteLine(e.KeyValue)
            Debug.WriteLine(e.KeyCode)
    
        End Sub
    
        Private Sub UserControl1_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles Me.KeyPress
            Debug.WriteLine("pressed")
            Debug.WriteLine(e.KeyChar)
        End Sub
    End Class