i have a form that needs to be maximized in vb.net. i dont want the user to be able to change its size or move it around.
A:
To prevent users from resizing, set the FormBoderStyle to Fixed3D or FixedDialog from properties window or from code
frmYour.BorderStyle = System.WinForms.FormBorderStyle.Fixed3D
And set the WindowState property to Maximized, set the MaximizeBox and MinimizeBox properties to false.
To prevent the user from moving around, override WndProc
Protected Overrides Sub WndProc(ByRef m As Message)
Const WM_NCLBUTTONDOWN As Integer = 161
Const WM_SYSCOMMAND As Integer = 274
Const HTCAPTION As Integer = 2
Const SC_MOVE As Integer = 61456
If (m.Msg = WM_SYSCOMMAND) And (m.WParam.ToInt32() = SC_MOVE) Then
Return
End If
If (m.Msg = WM_NCLBUTTONDOWN) And (m.WParam.ToInt32() = HTCAPTION) Then
Return
End If
MyBase.WndProc(m)
End Sub
amazedsaint
2009-07-13 12:52:01
I havn't completed. See the code above.
amazedsaint
2009-07-13 13:06:28
wow what is the significance of all those integers?
I__
2009-07-13 13:09:23
constants for passing to windows api - each integer represents a Windows Message command and corresponding parameter
amazedsaint
2009-07-13 13:27:31
whoever marked this down please mark it back up
I__
2009-07-15 10:50:49
+1
A:
You can remove the UI to control this with:
frmYour.MinimizeBox = False
frmYour.MaximizeBox = False
Rowland Shaw
2009-07-13 12:56:25
+1
A:
Set the window start style as maximized. Then, hide the minimize and maximize buttons.
NYSystemsAnalyst
2009-07-13 12:58:38
+1
A:
//Set fixed border
yourForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.Fixed3D
//Set the state of your form to maximized
yourForm.WindowState = FormWindowState.Maximized
//Disable the minimize box and the maximize box
yourForm.MinimizeBox = False
yourForm.MaximizeBox = False
Francis B.
2009-07-13 13:02:22
A:
Set the min and max size of form to same numbers. Do not show min and max buttons.
Brian Spencer
2009-07-13 14:02:23