Sigal Laniado
November 18th, 1999, 08:21 AM
I don't want the form to be displayed on all the screen width when it is maximized by the user ? can i do it? How?
|
Click to See Complete Forum and Search --> : Maximize form HELP.. Sigal Laniado November 18th, 1999, 08:21 AM I don't want the form to be displayed on all the screen width when it is maximized by the user ? can i do it? How? Lothar Haensler November 18th, 1999, 09:30 AM I can think of 2 ways to do it: 1. the ugly way: trap the Form_Resize event private Sub Form_Resize() If WindowState = vbMaximized then me.WindowState = vbNormal me.Height = 800 End If End Sub ugly, because it causes flickering effect 2. the nice way: use subclassing and trap the WM_GETMINMAXINFO message -> no flicker, but more work Sigal Laniado November 18th, 1999, 10:08 AM Thank you!! I am a beginner - can you tell me more about the second option Tanks Sigal. Lothar Haensler November 18th, 1999, 10:15 AM Ok, here is the sample code for one of my projects: private Const WM_GETMINMAXINFO = &H24 private Declare Sub CopyMemory Lib "KERNEL32" Alias "RtlMoveMemory" (lpDest as Any, lpSource as Any, byval nCount as Long) 'Windows data types private Type POINTAPI x as Long y as Long End Type private Type MINMAXINFO ptReserved as POINTAPI ptMaxSize as POINTAPI ptMaxPosition as POINTAPI ptMinTrackSize as POINTAPI ptMaxTrackSize as POINTAPI End Type ' initialize Subclass.ocx scs.hwnd = me.hwnd scs.Messages(WM_GETMINMAXINFO) = true private Sub scs_WndProc(Msg as Long, wParam as Long, lParam as Long, Result as Long) Dim MinMax as MINMAXINFO If Msg = WM_GETMINMAXINFO then 'Copy to our local MinMax variable CopyMemory MinMax, byval lParam, len(MinMax) 'set minimum/maximum tracking size MinMax.ptMinTrackSize.x = (me.cmdSave.Left + me.cmdSave.Width * 1.25) / Screen.TwipsPerPixelX MinMax.ptMinTrackSize.y = (3 * fraTrans.Height) / Screen.TwipsPerPixelY 'Copy data back to Windows CopyMemory byval lParam, MinMax, len(MinMax) Result = 0 End If End Sub it makes use of a freeware ocx: subclass.ocx (don't remember where I downloaded it from). This code does NOT allow to make the window smaller than I want, no matter how hard the user tries. Sigal Laniado November 21st, 1999, 12:39 AM Thanks you very much. I hope it will help me!. codeguru.com
Copyright Internet.com Inc., All Rights Reserved. |