C#

[C#/PDA]가상키보드(Inputpanel) 위치 변경 예제

선영아 사랑해 2016. 1. 28. 11:57


PDA 프로그램을 개발하다보면 고객의 요구에 의해 inputpanel을 사용해야 하는 경우가 있습니다.


화면 디자인에 따라 inputpanel의 위치를 이동을 해야 할 때 사용 할 수 있는 예제 코드이오니 참고하세요...



using System.Runtime.InteropServices;


[DllImport("coredll.dll")]
private static extern bool SipSetInfo(ref SIPINFO pSipInfo);

[DllImport("coredll.dll")]
private static extern bool SipGetInfo(ref SIPINFO pSipInfo);

private struct SIPINFO
{
    public Int32 cbSize;
    public Int32 fdwFlags;
    public RECT rcVisibleDesktop;
    public RECT rcSipRect;
    public Int32 dwImDataSize;
    public Int32 pvImData;
}

private struct RECT
{
    public Int32 left;
    public Int32 top;
    public Int32 right;
    public Int32 bottom;
}

public void SetPosition(Int32 top, Int32 left)
{
    SIPINFO mySi = new SIPINFO();

    bool result = true;
   
    mySi.cbSize = System.Runtime.InteropServices.Marshal.SizeOf(typeof(SIPINFO));

    result = SipGetInfo(ref mySi);
   
    mySi.rcSipRect.top = top;
   
    mySi.rcSipRect.left = left;
   
    mySi.rcSipRect.bottom = top + 80;
   
    result = SipSetInfo(ref mySi);
}

private void button_Click(object sender, EventArgs e)
{
 SetPosition(120, 0);
}