|
-
March 15th, 2001, 03:55 AM
#1
Lock form resizing
Hi
I wan't to make form Maximize and without option to resize it.
I set that form properties:
BorderStyle = 1 - FixedSingle
WindowState = Maximized
I run the program and the form is Maximizes without option to resize...
But if i DblClicked on the form Caption the form resize to normal size.
How can I prevent that action ???
(without set the size to Maximize in the Resize event!)
Thank you for help.
-
March 15th, 2001, 04:09 AM
#2
Re: Lock form resizing
There is a solution that involves subclassing and is a bit involved if you actually are a beginner - it's posted at http://www.merrioncomputing.com in the advanced section of the Visual Basic index.
-------------------------------------------------
Ex. Datis: Duncan Jones
Merrion Computing Ltd
http://www.merrioncomputing.com
-
March 15th, 2001, 07:01 AM
#3
Re: Lock form resizing
Make
Me.Height = Screen.Height
Me.Width = Screen.Width
Now, with the BorderStyle set to fixed single, you get a maximized form that will not resize. But it will move still.
If you remove the Move item from a form's control menu, the user will not be able to move it in any way.
Here is a code sample that will prevent the user from both moving and resizing a form by modifying the system menu.
private Declare Function GetSystemMenu Lib "User" (byval hWnd%, byval bRevert%) as Integer
private Declare Function DeleteMenu Lib "user" (byval hMenu%, byval iditem%, byval wflags%) as Integer
private Const SC_SIZE = &HF000
private Const SC_MOVE = &HF010
private Const MF_BYCOMMAND = &H0
Sub Form_Load()
Dim hWnd%, hMenu%, Success%
hWnd% = me.hWnd
hMenu% = GetSystemMenu(hWnd%, 0)
Success% = deletemenu(hMenu%, SC_SIZE, MF_BYCOMMAND)
Success% = deletemenu(hMenu%, SC_MOVE, MF_BYCOMMAND)
End Sub
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
|