首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Windows Mobile >

vs2008开发wm程序如何让打开输入法窗体自动缩小

2012-05-10 
vs2008开发wm程序怎么让打开输入法窗体自动缩小?如题,例如做一个记事本,输入法一打开编辑框就被挡住了,怎

vs2008开发wm程序怎么让打开输入法窗体自动缩小?
如题,例如做一个记事本,输入法一打开编辑框就被挡住了,怎么让它自己缩小?

[解决办法]
输入法位置可以上下移动,移动到合适位置就行。。
http://www.cnblogs.com/springtrace/archive/2009/08/31/1557193.html
[解决办法]
输入法操作,有一套 SIP 函数,LZ可以研究一下
[解决办法]
引用wince.dll,有一个控件叫inputpanel,就是专门干这事的。
[解决办法]
你要修改SIP 的大小?

我想,你是应该修改 TextBox的大小吧。呵呵

控件.Height = inputPanel1.VisibleDesktop.Height;
[解决办法]
在微软MVP的娇嗔里有一讲 谈到了这个你可以去找找 参考一下 具体是那年哪期我不记得了
[解决办法]

LRESULT CDialogEx::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) 
{
switch(message)
{
case WM_SETTINGCHANGE:
{
if (wParam==SPI_SETSIPINFO) 
{
SIPINFO si;
memset(&si, 0, sizeof (si));
si.cbSize = sizeof (si);
if (SipGetInfo(&si)) 
{
RECT rect,rect1;
CWnd *wnd = GetFocus();
if(wnd!=NULL)
{
wnd->GetWindowRect(&rect1);
}
if(si.fdwFlags & SIPF_ON)
{

int k = si.rcSipRect.bottom-si.rcSipRect.top;

//this->SetScrollRange(SB_VERT,0,k,TRUE);
int z ;

if(rect1.top<k)
z=0;
else
z=k;

this->SetScrollRange(SB_VERT,0,k,TRUE);
if(z>0)
{
static int s_offsetX = 0;
static int s_offsetY = 0;
RECT rc;
this->GetWindowRect(&rc);
SCROLLINFO si = {sizeof(SCROLLINFO), 
SIF_PAGE|SIF_POS|SIF_RANGE|SIF_TRACKPOS, 0, 0, 0, 0, 
0};
this->GetScrollInfo ( SB_VERT, &si);
int MIN_VSCROLL_VALUE = 0;
int MAX_VSCROLL_VALUE = si.nMax;

int iInterval = 0;
int nCurPos = si.nPos;
nCurPos =z;

if(nCurPos < MIN_VSCROLL_VALUE)
nCurPos = MIN_VSCROLL_VALUE;
else if(nCurPos >MAX_VSCROLL_VALUE)
nCurPos = MAX_VSCROLL_VALUE;

iInterval = nCurPos - si.nPos;
g_iPosChange += iInterval;//

if(0 != iInterval)
{
s_offsetY = s_offsetY+iInterval;
si.fMask = SIF_POS;
si.nPos = nCurPos;
this->SetScrollInfo ( SB_VERT, &si, TRUE);
this->ScrollWindowEx(0, -iInterval, NULL, NULL, 
NULL, NULL, SW_SCROLLCHILDREN);//
}
this->InvalidateRect(NULL,TRUE);
}
}
else
{
this->SetScrollRange(SB_VERT,0,0,TRUE);
this->ScrollWindowEx(0, g_iPosChange, NULL, NULL, NULL, NULL, SW_SCROLLCHILDREN);
g_iPosChange=0;
}
this->GetClientRect( &rect);
this->InvalidateRect( &rect, TRUE); 
}
}

}
break;
case WM_VSCROLL:
{
static int s_offsetX = 0;
static int s_offsetY = 0;
RECT rc;
this->GetWindowRect(&rc);
SCROLLINFO si = {sizeof(SCROLLINFO), 
SIF_PAGE|SIF_POS|SIF_RANGE|SIF_TRACKPOS, 0, 0, 0, 0, 
0};
this->GetScrollInfo ( SB_VERT, &si);
int MIN_VSCROLL_VALUE = 0;
int MAX_VSCROLL_VALUE = si.nMax;

int iInterval = 0;
int nCurPos = si.nPos;

switch ( (int)LOWORD(wParam))
{


case SB_LINEUP:
nCurPos -= 20;
break;

case SB_PAGEUP:
nCurPos -= 60;
break;

case SB_LINEDOWN:
nCurPos += 20;
break;

case SB_PAGEDOWN:
nCurPos += 60;
break;

case SB_TOP:
nCurPos = MIN_VSCROLL_VALUE;
break;

case SB_BOTTOM:
nCurPos = MAX_VSCROLL_VALUE;
break;

case SB_THUMBTRACK:
case SB_THUMBPOSITION:
nCurPos = si.nTrackPos; 
break;
}
if(nCurPos < MIN_VSCROLL_VALUE)
nCurPos = MIN_VSCROLL_VALUE;
else if(nCurPos >MAX_VSCROLL_VALUE)
nCurPos = MAX_VSCROLL_VALUE;

iInterval = nCurPos - si.nPos;
g_iPosChange += iInterval;//

if(0 != iInterval)
{
s_offsetY = s_offsetY+iInterval;
si.fMask = SIF_POS;
si.nPos = nCurPos;
this->SetScrollInfo ( SB_VERT, &si, TRUE);
this->ScrollWindowEx(0, -iInterval, NULL, NULL, 
NULL, NULL, SW_SCROLLCHILDREN);//
}
this->InvalidateRect(NULL,TRUE);
}
break;
}
return CDialog::WindowProc(message, wParam, lParam);
};

热点排行