|
-
November 18th, 1999, 09:21 AM
#1
Maximize form HELP..
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?
-
November 18th, 1999, 10:30 AM
#2
Re: Maximize form HELP..
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
-
November 18th, 1999, 11:08 AM
#3
Re: Maximize form HELP..
Thank you!! I am a beginner - can you tell me more about the second option
Tanks
Sigal.
-
November 18th, 1999, 11:15 AM
#4
Re: Maximize form HELP..
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.
-
November 21st, 1999, 01:39 AM
#5
Re: Maximize form HELP..
Thanks you very much. I hope it will help me!.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|