How do I permanently size the view?
Abu A. Wawda -- wawda@scf.usc.edu Thursday, May 16, 1996 VC++ 2.0, Win95/NT I am writing an app that requires me to have the make the view window a certain size (350x250 pixels). The frame window should not be able to be sized. I know how to do this by changing the CREATERSTRUCT structure in CFrameWnd::PreCreateWnd(). But how do I get the view to be a fixed size since I do have a status bar also? Thanks, .===================================================================. | Abu A. Wawda | wawda@scf.usc.edu | http://www.netvoyage.net/~abu/ | |-------------------------------------------------------------------| | "The world is a comedy to those that think, | Live Long | | a tragedy to those who feel." - H. Walpole. | and Prosper... | `==================================================================='
Frederic Steppe -- FredericS@msn.com Sunday, May 19, 1996 [Mini-digest: 2 responses] >VC++ 2.0, Win95/NT > >I am writing an app that requires me to have the make the view window a >certain size (350x250 pixels). The frame window should not be able to be >sized. I know how to do this by changing the CREATERSTRUCT structure in >CFrameWnd::PreCreateWnd(). But how do I get the view to be a fixed size >since I do have a status bar also? There is an easy way to do that. You'll have to derive you view from CScrollView. In your view's OnInitialUpdate, make the following calls : GetParentFrame()->RecalcLayout(); ResizeParentToFit(FALSE); You may trap the display/hide command for the status bar and/or toolbars to recalc layout and resize as needed. Frederic Steppe (frederics@msn.com) -----From: "James Ross"Handle WM_GETMINMAXINFO. This message lets you constrain the minimum and maximum size of a window Jim
Terry Trippany -- terryt@str.com Monday, May 20, 1996 Hi, The following calls should make the Frame be the same size as the view. The view may also be a CFormView which itself is derived from CScrollView. Use CFormView if you need a dialog based view application. GetParentFrame()->RecalcLayout(); ResizeParentToFit(FALSE); Be warned that setting the ResizeParentToFit(FALSE) parameter to FALSE tells it to resize your frame window in any case, smaller or larger. If you create a window larger than your screen you may have a little trouble closing it down without the mouse. Test it through the debugger just in case. However, this will not bind the Frame to any particular size. You will still be allowed to resize the main frame unless you turn the max box and maximize menu items off. This may be done by setting the frames CREATESTRUCT through an override on the CFrameWnd PreCreateWindow method as follows. // TMT - Override BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) { // TODO: Modify the Window class or styles here by modifying // the CREATESTRUCT cs // only minimize with no maximize menu item - set styles as needed cs.style = WS_OVERLAPPED | WS_SYSMENU | WS_MINIMIZEBOX | WS_BORDER; return CFrameWnd::PreCreateWindow(cs); } Of course you can do this through the AppWizard if you choose the advanced options and set your main window styles there. In order for the above to work you must make the view have a size of 350x250 and not the frame. You can change the size of a view through a call to MoveWindow() in MFC applications. void MoveWindow( int x, int y, int nWidth, int nHeight, BOOL bRepaint = TRUE ); void MoveWindow( LPCRECT lpRect, BOOL bRepaint = TRUE ); You must take care of all the conversions to make this device independant. Hope this helps. Terry Trippany "I stream, therefore I have some place to go!" Senior Consultant Strategic Technology Resources Chicago, IL terryt@str.com , terryt@mcs.com At 10:04 AM 5/19/96 UT, you wrote: >[Mini-digest: 2 responses] > >>VC++ 2.0, Win95/NT >> >>I am writing an app that requires me to have the make the view window a >>certain size (350x250 pixels). The frame window should not be able to be >>sized. I know how to do this by changing the CREATERSTRUCT structure in >>CFrameWnd::PreCreateWnd(). But how do I get the view to be a fixed size >>since I do have a status bar also? > >There is an easy way to do that. >You'll have to derive you view from CScrollView. >In your view's OnInitialUpdate, make the following calls : > GetParentFrame()->RecalcLayout(); > ResizeParentToFit(FALSE); > >You may trap the display/hide command for the status bar and/or toolbars to >recalc layout and resize as needed. > >Frederic Steppe (frederics@msn.com) > >-----From: "James Ross"> >Handle WM_GETMINMAXINFO. This message lets you constrain the minimum and >maximum size of a window > >Jim > >
Niv -- Niv.Maman@ecitele.com Sunday, May 26, 1996 Abu Wawda wrote: > > VC++ 2.0, Win95/NT > > I am writing an app that requires me to have the make the view window a > certain size (350x250 pixels). The frame window should not be able to be > sized. I know how to do this by changing the CREATERSTRUCT structure in > CFrameWnd::PreCreateWnd(). But how do I get the view to be a fixed size > since I do have a status bar also? > > Thanks, > > .===================================================================. > | Abu A. Wawda | wawda@scf.usc.edu | http://www.netvoyage.net/~abu/ | > |-------------------------------------------------------------------| > | "The world is a comedy to those that think, | Live Long | > | a tragedy to those who feel." - H. Walpole. | and Prosper... | > `===================================================================' use the getminmaxinfo of the MdiChildWnd which is the frame of your view
| Вернуться в корень Архива |