Results 1 to 4 of 4

Thread: I have no problem allowing resizing MDIForm ?

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Mar 2008
    Posts
    519

    I have no problem allowing resizing MDIForm ?

    I encountered no problems when resizing allows MDIForm, when running this code below:
    Code:
    Private mHeight As Long, mWidth As Long   
    Private Sub MDIForm_Load()     
    mHeight = Me.Height     
    mWidth = Me.Width  
    End Sub   
    
    'disable mdi form resize
    Private Sub MDIForm_Resize()     
    Me.WindowState = 0 'Normal    
    Me.Height = mHeight     
    Me.Width = mWidth  
    End Sub
    when I press MinButton of MIDIForm not. can change the code above to just have two functions: do not allow to resize and allow MinButton (or allow MaxButton) of MDIForm it ?

  2. #2
    PowerPoster Nightwalker83's Avatar
    Join Date
    Dec 2001
    Location
    Adelaide, Australia
    Posts
    13,344

    Re: I have no problem allowing resizing MDIForm ?

    If I understand you can resize the form because you are setting to the "Normal" size.

    vb Code:
    1. Me.WindowState = 0
    when you quote a post could you please do it via the "Reply With Quote" button or if it multiple post click the "''+" button then "Reply With Quote" button.
    If this thread is finished with please mark it "Resolved" by selecting "Mark thread resolved" from the "Thread tools" drop-down menu.
    https://get.cryptobrowser.site/30/4111672

  3. #3
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    14,205

    Re: I have no problem allowing resizing MDIForm ?

    I can't understand the question.

    You can't re-size a form if it is set to min or max. You can re-size a form if it is set to normal and the border style allows it to be re-sized.

    So what is your question?

  4. #4
    Default Member Bonnie West's Avatar
    Join Date
    Jun 2012
    Location
    InIDE
    Posts
    4,060

    Re: I have no problem allowing resizing MDIForm ?

    Perhaps the following is what you want?

    Code:
    Option Explicit
    
    Private Const GWL_STYLE  As Long = (-16&)   'Retrieves the window styles.
    Private Const WS_SIZEBOX As Long = &H40000  'The window has a sizing border.
    
    Private Declare Function GetWindowLong Lib "user32.dll" Alias "GetWindowLongW" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
    Private Declare Function SetWindowLong Lib "user32.dll" Alias "SetWindowLongW" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    
    Private Sub MDIForm_Load()
        Move Left, Top, 800! * Screen.TwipsPerPixelX, 600! * Screen.TwipsPerPixelY          'Resize MDIForm to 800x600 px
        SetWindowLong hWnd, GWL_STYLE, GetWindowLong(hWnd, GWL_STYLE) And Not WS_SIZEBOX    'Disable resizing from now on
    End Sub
    On Local Error Resume Next: If Not Empty Is Nothing Then Do While Null: ReDim i(True To False) As Currency: Loop: Else Debug.Assert CCur(CLng(CInt(CBool(False Imp True Xor False Eqv True)))): Stop: On Local Error GoTo 0
    Declare Sub CrashVB Lib "msvbvm60" (Optional DontPassMe As Any)

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