CSDN博客

img bohut

如何改变标题栏的宽度

发表于2004/10/29 15:47:00  1502人阅读


方法一:

NONCLIENTMETRICS ncm;
ncm.cbSize = sizeof( NONCLIENTMETRICS );

::SystemParametersInfo( SPI_GETNONCLIENTMETRICS,
sizeof( NONCLIENTMETRICS ),
&ncm,
0
);

ncm.lfCaptionFont.lfHeight = -300;
::SystemParametersInfo( SPI_SETNONCLIENTMETRICS,
sizeof( NONCLIENTMETRICS ),
&ncm,
SPIF_SENDCHANGE
);
 

方法二:

case WM_NCCALCSIZE:
{
BOOL bSpecial=FALSE;
int nEdgeWidth =3;
int nBarHeight =CAPTIONHEIGHT+3;
int nBottomEdge =3;

if(!(BOOL)wParam)
{
RECT rtSave;
CopyRect(&rtSave,(LPRECT)lParam);
// ::CallWindowProcA(lpwndinfo->pWndProc,hWnd,uMsg,wParam,lParam);


if(lpwndinfo->bIM ==TRUE)
{
int imbarheight =17;
rtSave.left+=nEdgeWidth;
rtSave.top+=imbarheight+3;
rtSave.right-=nEdgeWidth;
rtSave.bottom-=nBottomEdge;
}
else
{
rtSave.left+=nEdgeWidth;
rtSave.top+=nBarHeight;
rtSave.right-=nEdgeWidth;
rtSave.bottom-=nBottomEdge;
}
CopyRect((LPRECT)lParam,&rtSave);

*lResult=0;
::ReleaseDC(hWnd,hDC);
return TRUE;
}
else
{
RECT rtSave;
LPRECT prtClt;
LPNCCALCSIZE_PARAMS pNC;
pNC=(LPNCCALCSIZE_PARAMS)lParam;

prtClt=&(pNC->rgrc[0]);
CopyRect(&rtSave,prtClt);
CopyRect( &(pNC->rgrc[2]), &(pNC->rgrc[1]));

if(bSysDlg)
{
(pNC->rgrc[2]).left +=nEdgeWidth;
(pNC->rgrc[2]).right -=nEdgeWidth;
}
else
{
if(lpwndinfo->bIM ==TRUE)
{
int imbarheight =17;
(pNC->rgrc[2]).left +=nEdgeWidth;
(pNC->rgrc[2]).top +=imbarheight+3;
(pNC->rgrc[2]).right -=nEdgeWidth;
(pNC->rgrc[2]).bottom -=nBottomEdge;

rtSave.left+=nEdgeWidth;
rtSave.top+=imbarheight+3;
rtSave.right-=nEdgeWidth;
rtSave.bottom-=nBottomEdge;
}
else
{
(pNC->rgrc[2]).left+=nEdgeWidth;
(pNC->rgrc[2]).top+=nBarHeight;
(pNC->rgrc[2]).right-=nEdgeWidth;
(pNC->rgrc[2]).bottom-=nBottomEdge;
// Result=::CallWindowProcA(lpwndinfo->pWndProc,hWnd,uMsg,wParam,lParam);
//prtClt=&(pNC->rgrc[0]);
rtSave.left+=nEdgeWidth;
rtSave.top+=nBarHeight;
rtSave.right-=nEdgeWidth;
rtSave.bottom-=nBottomEdge;
}
}
CopyRect(prtClt,&rtSave);
*lResult=0;
::ReleaseDC(hWnd,hDC);
return TRUE;
}
break;
}

0 0

相关博文

我的热门文章

img
取 消
img