搞笑! 楼上的各位:楼主要的是定制sdi的client的size,而不是sdi的window size 不知道各位是没有看明白,还是不会呢?mapping the message:WM_GETMINMAXINFO ---------------------------------------------------- void CMainFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) { // 1 - Let the default window proc fill the MINMAXINFO structure CFrameWnd::OnGetMinMaxInfo(lpMMI);
// Calculate the "non-client overhead" of the frame window CRect rectClient; GetClientRect( &rectClient ); CRect rectWindow; GetWindowRect( &rectWindow ); int nWidthOverhead = rectWindow.Width() - rectClient.Width(); int nHeightOverhead = rectWindow.Height() - rectClient.Height(); // 2 - Modify the MINMAXINFO structure to reflect our // size limits // Here we want a minimum CLIENT size of 200x50 pixels // and a maximum CLIENT size of 400x200 pixels lpMMI->ptMinTrackSize.x = 200 + nWidthOverhead; lpMMI->ptMinTrackSize.y = 50 + nHeightOverhead; lpMMI->ptMaxTrackSize.x = 400 + nWidthOverhead; lpMMI->ptMaxTrackSize.y = 200 + nHeightOverhead;
搞笑! 楼上的各位:楼主要的是定制sdi的client的size,而不是sdi的window size 不知道各位是没有看明白,还是不会呢?mapping the message:WM_GETMINMAXINFO ---------------------------------------------------- void CMainFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI) { // 1 - Let the default window proc fill the MINMAXINFO structure CFrameWnd::OnGetMinMaxInfo(lpMMI);
// Calculate the "non-client overhead" of the frame window CRect rectClient; GetClientRect( &rectClient ); CRect rectWindow; GetWindowRect( &rectWindow ); int nWidthOverhead = rectWindow.Width() - rectClient.Width(); int nHeightOverhead = rectWindow.Height() - rectClient.Height(); //请问psusong(不要问我任何问题,因为我根本就不存在!) //我进行单步调试,发现nWidthOverhead和nHeightOverhead居然都为0!!! //是否这几句无用? // 2 - Modify the MINMAXINFO structure to reflect our // size limits // Here we want a minimum CLIENT size of 200x50 pixels // and a maximum CLIENT size of 400x200 pixels lpMMI->ptMinTrackSize.x = 200 + nWidthOverhead; lpMMI->ptMinTrackSize.y = 50 + nHeightOverhead; lpMMI->ptMaxTrackSize.x = 400 + nWidthOverhead; lpMMI->ptMaxTrackSize.y = 200 + nHeightOverhead;
CWnd::SetWindowPos至于去掉滚动条是什么意思我就不知道了
uFlags = SWP_DRAWFRAME |SWP_FRAMECHANGED;
AdjustWindwRect(&rc. WS_CHILD, FALSE);
SetWindowPos(hWnd, HWND_TOP, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, SWP_SHOWWINDOW);
可以将客户设置为想要的大小。
{
if( !CFrameWnd::PreCreateWindow(cs) )
return FALSE; cs.cx=624; //根据你的窗体大小进行调整
cs.cy=520; //根据你的窗体大小进行调整 cs.style&=~FWS_ADDTOTITLE;
return TRUE;
}
{ if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
CRect rc;
rc.left=lpCreateStruct->x;
rc.top=lpCreateStruct->y;
rc.right=700;//设置客户区的宽度
rc.bottom=300;//设置客户区的高度 CalcWindowRect(&rc);
MoveWindow(&rc); //... return 0;
}
1、查看
CYourFrameWnd::OnSize(UINT nType,int x,int y)
{
CFrameWnd::OnSize(..);//设置的过程在此
}
将该行注释掉,就变成了
CYourFrameWnd::OnSize(UINT nType,int x,int y)
{
// CFrameWnd::OnSize(..);
YourToolbar.MoveWindow(..);
YourStatusbar.MoveWindow(..);
YourView.MoveWindow(..);
}
至于ScrollBar的存在不是Frame里面的,是YourScrollView的。
换成CYourView:public CView即可。
楼上的各位:楼主要的是定制sdi的client的size,而不是sdi的window size
不知道各位是没有看明白,还是不会呢?mapping the message:WM_GETMINMAXINFO
----------------------------------------------------
void CMainFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
{
// 1 - Let the default window proc fill the MINMAXINFO structure
CFrameWnd::OnGetMinMaxInfo(lpMMI);
// Calculate the "non-client overhead" of the frame window
CRect rectClient;
GetClientRect( &rectClient ); CRect rectWindow;
GetWindowRect( &rectWindow ); int nWidthOverhead = rectWindow.Width() - rectClient.Width();
int nHeightOverhead = rectWindow.Height() - rectClient.Height(); // 2 - Modify the MINMAXINFO structure to reflect our
// size limits // Here we want a minimum CLIENT size of 200x50 pixels
// and a maximum CLIENT size of 400x200 pixels lpMMI->ptMinTrackSize.x = 200 + nWidthOverhead;
lpMMI->ptMinTrackSize.y = 50 + nHeightOverhead; lpMMI->ptMaxTrackSize.x = 400 + nWidthOverhead;
lpMMI->ptMaxTrackSize.y = 200 + nHeightOverhead;
}
你现在正打开的IE窗口就是SDI,明白了就记得给分啊??
------
我现在用myie2的外壳浏览器,那还是SDI吗?:)
楼主只是要设置客户区的大小,这关WM_GETMINMAXINFO什么事了?不明白
{ if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;
CRect rc;
rc.left=lpCreateStruct->x;
rc.top=lpCreateStruct->y;
rc.right=700;//设置客户区的宽度
rc.bottom=300;//设置客户区的高度 CalcWindowRect(&rc);//####请大家注意这个函数,它将非客户区的大小加到rc这个结构上,也就是说调用这个函数后,rc里的值就不再是上面指定的客户区的大小了,而是加上了非客户区的大小,于是下面就可以用MoveWindow来搞定了. MoveWindow(&rc); //... return 0;
}
我能设置窗体的大小和位置,我想知道的是 client area 怎样设置或计算。拜托各位不吝赐教! 系统生成的窗体下面有 scrollbar 而我不想要这个东东,请问怎样去掉它?
请仔细分析一下需求好不好啊????
不知道是否跟下面这个消息有关?嘻嘻.....WM_NCCALCSIZE
--------
您可是以前的bcb_fans????????????????????我想跟这个消息没关吧,虽然MSDN上说这个是设置client的大小,我试过后发现其实更正确的说法应该是设置非客户区的大小才对,不过这本来就是相对的,呵呵
用WM_GETMINMAXINFO就行了
用别的方法都是走了弯路
psusong(不要问我任何问题,因为我根本就不存在!):
通过你的方法,把MIN值和MAX值设为一个值,可以达到直接设置客户区大小的目的。
但是,采用你的方法,也会有一个缺点:
程序刚出来时,大小不会是自己想要的,这时,用鼠标轻轻点一下程序的边框(就是调节大小那种方式,但不用拉,也拉不动,只需要点一下),客户区就设置为想要的大小了。
有办法解决这个问题吗?
搞笑!
楼上的各位:楼主要的是定制sdi的client的size,而不是sdi的window size
不知道各位是没有看明白,还是不会呢?mapping the message:WM_GETMINMAXINFO
----------------------------------------------------
void CMainFrame::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
{
// 1 - Let the default window proc fill the MINMAXINFO structure
CFrameWnd::OnGetMinMaxInfo(lpMMI);
// Calculate the "non-client overhead" of the frame window
CRect rectClient;
GetClientRect( &rectClient ); CRect rectWindow;
GetWindowRect( &rectWindow ); int nWidthOverhead = rectWindow.Width() - rectClient.Width();
int nHeightOverhead = rectWindow.Height() - rectClient.Height();
//请问psusong(不要问我任何问题,因为我根本就不存在!)
//我进行单步调试,发现nWidthOverhead和nHeightOverhead居然都为0!!!
//是否这几句无用?
// 2 - Modify the MINMAXINFO structure to reflect our
// size limits // Here we want a minimum CLIENT size of 200x50 pixels
// and a maximum CLIENT size of 400x200 pixels lpMMI->ptMinTrackSize.x = 200 + nWidthOverhead;
lpMMI->ptMinTrackSize.y = 50 + nHeightOverhead; lpMMI->ptMaxTrackSize.x = 400 + nWidthOverhead;
lpMMI->ptMaxTrackSize.y = 200 + nHeightOverhead;
}