Results 1 to 7 of 7

Thread: Stop Resizing

  1. #1

    Thread Starter
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303
    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.
    Thanks in advance for any help provided.

    VB 6 Enterprise Edition SP4
    ADO, SQL 7/2000, ASP and some JavaScript


    >> Life goes on, but for how long? <<
    If you can smile when things go wrong, you have someone in mind to blame

  2. #2
    Lively Member
    Join Date
    Jun 2000
    Location
    A caravan park in the Midlands (UK)
    Posts
    101
    Won't just changing the border style property to 'fixed single' do the jobby?
    Anakim

    It's a small world but I wouldn't like to paint it.

  3. #3
    Lively Member
    Join Date
    Sep 1999
    Location
    Liverpool, UK
    Posts
    64

    Cool

    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

  4. #4
    Lively Member
    Join Date
    Sep 1999
    Location
    Liverpool, UK
    Posts
    64
    wrong way round, sorry

    Private Sub MDIForm_Resize()

    Me.Width = MDIWidth
    Me.Height = MDIHeight

    End Sub

  5. #5
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892
    For MDI Forms, this is the best way I can consciously think of right now:
    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

  6. #6

    Thread Starter
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303
    Not with a MDI form, it will with a normal form!
    Thanks in advance for any help provided.

    VB 6 Enterprise Edition SP4
    ADO, SQL 7/2000, ASP and some JavaScript


    >> Life goes on, but for how long? <<
    If you can smile when things go wrong, you have someone in mind to blame

  7. #7
    Lively Member
    Join Date
    Jun 2000
    Location
    A caravan park in the Midlands (UK)
    Posts
    101

    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.

    Anakim

    It's a small world but I wouldn't like to paint it.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width