How can I force a MDI Form to always stay one size. So when people try to resize it in anyway it stays the same.
Printable View
How can I force a MDI Form to always stay one size. So when people try to resize it in anyway it stays the same.
Won't just changing the border style property to 'fixed single' do the jobby?
Couldn't you get the various size values during the Load event i.e.
Private Sub MDIForm_Load()
MDIHeight = me.height
MDIWidth = me.width
End Sub
And then in the resize event, reassign these values so when the user resizes the form it goes back the way it was, i.e.
Private Sub MDIForm_Resize()
Me.Width = MDIHeight
Me.Height = MDIWidth
End Sub
wrong way round, sorry
Private Sub MDIForm_Resize()
Me.Width = MDIWidth
Me.Height = MDIHeight
End Sub
For MDI Forms, this is the best way I can consciously think of right now: :rolleyes:
Code:Option Explicit
Private Declare Function GetSystemMenu Lib "user32" (ByVal hWnd As Long, ByVal bRevert As Long) As Long
Private Declare Function DeleteMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long
Private Declare Function DrawMenuBar Lib "user32" (ByVal hWnd As Long) As Long
Private Const SC_SIZE = &HF000
Private Const SC_MAXIMIZE = &HF030
Private Sub MDIForm_Load()
Dim hMenu As Long
hMenu = GetSystemMenu(hWnd, False)
Call DeleteMenu(hMenu, SC_SIZE, 0)
Call DeleteMenu(hMenu, SC_MAXIMIZE, 0)
Call DrawMenuBar(hWnd)
End Sub
Not with a MDI form, it will with a normal form!
:rolleyes:
Spanner (with reference to me, one of the unfeasibly large spanners which only mechanics and plumbers ever seem to own)
Yonatan's answer looks pretty good. I use something similar to Joe's in my MDI app to prevent users from going below a certain size.
Personally I always allow some sizing cuz of the different display resolutions (and it saves some 'does it fit' testing.