Write full screen applications Program To make full use of the screen space, cancel the input method panel. But there is no input method panel. How do I set the display position of the Input Panel? One feasible method is to call P/invoke and call the input method in the program. The interface is as follows:
CodeAs follows:
Using System;
Using System. componentmodel;
Using System. drawing;
Using System. Windows. forms;
Using System. runtime. interopservices;
Namespace Smartdeviceproject1
{
[Structlayout (layoutkind. Sequential)]
Public Struct Rect
{
Public Int Left;
Public Int Top;
Public Int Right;
Public Int Bottom;
}
Public Struct Sipinfo
{
Public Int Cbsize; // Set to 48
Public Int Fdwflags; // Set to 0
Public Rectangle rcvisibledesktop; // Set to 0, 0, 0
Public Rectangle rcsiprect;
Public Int Dwimdatasize; // Set to 0
Public Intptr pvimdata; // Set to intptr. Zero
Public Sipinfo ( Int Anyone)
{
Cbsize = Marshal. sizeof ( Typeof (Sipinfo ));
Fdwflags = 0 ; // Set to 0
Rcvisibledesktop = New Rectangle ( 0 , 0 , 0 , 0 );
Rcsiprect = New Rectangle ( 0 , 0 , 0 , 0 );
Dwimdatasize = 0 ;
Pvimdata = Intptr. zero;
}
}
Public Partial Class Form1: Form
{
[Dllimport ( " Coredll. dll " )]
Public Extern Static Void Sipshowim ( Uint Dwflag );
[Dllimport ( " Coredll. dll " )]
Public Extern Static Bool Sipsetdefaultrect ( Ref Rect rectf );
[Dllimport ( " Coredll. dll " )]
Public Extern Static Bool Sipsetcurrentim ( Ref Intptr cslid );
[Dllimport ( " Coredll. dll " )]
Public Extern Static Bool Sipgetcurrentim ( Ref Intptr cslid );
[Dllimport ( " Coredll " )]
Public Extern Static Bool Sipgetinfo ( Ref Sipinfo );
Public Static Uint Sipf_off = 0x00 ;
Public Static Uint Sipf_on = 0x01 ;
Private Rect originalrect;
Private Int Sipclsid;
Public Form1 ()
{
Initializecomponent ();
}
Private Void Button#click ( Object Sender, eventargs E)
{
// Move the Input Panel up to 50 and enable the Input Method
Sipinfo = New Sipinfo ( 0 );
Sipgetinfo ( Ref Sipinfo );
Originalrect = New Rect ();
Originalrect. Left = Sipinfo. rcsiprect. X;
Originalrect. Top = Sipinfo. rcsiprect. Y;
Originalrect. Right = Sipinfo. rcsiprect. Right;
Originalrect. Bottom = Sipinfo. rcsiprect. height;
Rect newrect = New Rect ();
Newrect. Left = Sipinfo. rcsiprect. X;
Newrect. Top = Sipinfo. rcsiprect. Y - 50 ;
Newrect. Right = Sipinfo. rcsiprect. Right;
Newrect. Bottom = Sipinfo. rcsiprect. Height - 50 ;
Sipsetdefaultrect ( Ref Newrect );
Sipclsid = Inputpanel1.inputmethods [ 1 ]. Clsid. gethashcode ();
Intptr pointclsid = New Intptr (sipclsid );
If (Sipgetcurrentim ( Ref Pointclsid ))
{
Sipsetcurrentim (RefPointclsid );
}
Pointclsid = Intptr. zero;
Sipshowim (sipf_on );
}
Private Void Form1_closing ( Object Sender, canceleventargs E)
{
// Restore the original Input Panel and disable the input method.
Sipsetdefaultrect ( Ref Originalrect );
Sipclsid = Inputpanel1.inputmethods [ 1 ]. Clsid. gethashcode ();
Intptr pointclsid = New Intptr (sipclsid );
If (Sipgetcurrentim ( Ref Pointclsid ))
{
Sipsetcurrentim (RefPointclsid );
}
Pointclsid = Intptr. zero;
Sipshowim (sipf_off );
}
}
}
For more information, seeArticle: Managing the software Input Panel in your applications