Archive for the 'Links and articles - tutorials' Category
SIP support within the .NET Compact Framework
Within the .NET Compact Framework the software-based input panel is wrapped up by the Microsoft.WindowsCE.Forms.InputPanel class, which is present in the Microsoft.WindowsCE.Forms.dll assembly.
In order to interact with the software-based input panel, the user can drop the InputPanel component from the Visual Studio toolbox onto a form. A reference to the Microsoft.WindowsCE.Forms.dll assembly will be added automatically to your project.
Most applications utilising the InputPanel component will make use of the following four members of the class.
- Enabled - A boolean property. If true the SIP is visible (on the screen), if false the SIP is hidden.
- EnabledChanged - An event which fires whenever the Enabled property changes value.
- Bounds - A rectangle detailing the amount of screen real estate the current input method occupies.
- VisibleDesktop - A rectangle detailing the maximum size the current screen real estate the form can cover without being partially covered by the SIP.
Automatic SIP Popup
Within the .NET Compact Framework the easiest way to automatically display the Input Panel is to explicitly enable and disable the input panel whenever a control which requires keyboard focus is activated.
private TextBox txtUserName; private void Form1_Load(object sender, EventArgs e) { txtUserName.GotFocus += txtUserName_GotFocus; txtUserName.LostFocus += txtUserName_LostFocus; } private void txtUserName_GotFocus(object sender, EventArgs e) { // Show the input panel inputPanel1.Enabled = true; } private void txtUserName_LostFocus(object sender, EventArgs e) { // Hide the input panel inputPanel1.Enabled = false; }
Notice: Usually the event hook up code shown within the Form1_Load event handler would occur within the designer generated code. It is only shown here to aid in understanding how this sample code functions.
No comments