I want to write a custom control (a text editor) for Windows Forms, which should include the following functionality:
- Gets the keyboard focus, when you click on it with the mouse
- Sees all keyboard input (including cursor keys), when it has the focus,
- Can run in a semi-trusted environment, with
UIPermissionWindow.SafeTopLevelWindows
(i.e. it shouldn't requireUIPermissionWindow.AllWindows
)
Is there any example of doing this?
Some of the methods which I might want to use, like Control.Focus()
and Control.InInputKey()
, require UIPermissionWindow.AllWindows
.
Is there any other way to get/implement the functionality, without using these methods?
The built-in TextBox control has this functionality (gets the focus and handles cursor keys).