64,281
社区成员
发帖
与我相关
我的任务
分享
LRESULT MainWND_OnSize(HWND hwnd,WPARAM wParam,LPARAM lParam)
{
RECT rect;
GetWindowRect(hwnd,&rect);
//1.0 make expression effective .otherwise 1/3 = 0
fH_Stretch_ratio = (rect.right-rect.left-g_nFrameWidth)*1.0/nWindow_cx;
fV_Stretch_ratio = (rect.bottom-rect.top-g_nFrameHeight)*1.0/nWindow_cy;
if (!g_cdMainwindowManager.EmptyList())
{
g_cdMainwindowManager.DeferMoveItemCtrlDimen(fH_Stretch_ratio,fV_Stretch_ratio);
}
return 0;
}
BOOL HLPDLG_OnSize(HWND hwnd,WPARAM wParam,LPARAM lParam)
{
if (!g_cdDLPdlgCtrlManager.EmptyList())
{
//g_cdDLPdlgCtrlManager.MoveItemCtrlDimen(fH_Stretch_ratio,fV_Stretch_ratio);
g_cdDLPdlgCtrlManager.DeferMoveItemCtrlDimen(fH_Stretch_ratio,fV_Stretch_ratio);
}
return TRUE;
}
BOOL CCtrlDimen::DeferMoveItemCtrlDimen(float fhratio,float fvratio)
{
int nCtrlnum = 0;
Node * p = head;
while (p->pnext != NULL)
{
nCtrlnum++;
p = p->pnext;
}
if (nCtrlnum == 0 )
{
return FALSE;
}
HDWP hdwpbe = BeginDeferWindowPos(nCtrlnum);
HDWP hdwp;
p = head;
do
{
p = p->pnext;
hdwp = DeferWindowPos(hdwpbe,(HWND)p->hHandle,HWND_TOP,
p->nleft*fhratio,p->ntop*fvratio,p->nwidth*fhratio,p->nheight*fvratio,SWP_SHOWWINDOW);
} while (p->pnext != NULL);
EndDeferWindowPos(hdwp);
return TRUE;
}