为了使窗口在屏幕中央显示,采用如下代码:
CRect rect;
CClientDC dc(this);
int width = dc.GetDeviceCaps(HORZRES);
int height = dc.GetDeviceCaps(VERTRES);
GetWindowRect( &rect );
width = ( width - ( rect.right - rect.left ))/2 ;
height = (height - (rect.bottom - rect.top ))/2 ;
MoveWindow( width , height , (rect.right - rect.left ) , (rect.bottom - rect.top ) ,true);