Results 1 to 4 of 4

Thread: A form can't be moved or sized while minimized or maximized

  1. #1

    Thread Starter
    Fanatic Member mutley's Avatar
    Join Date
    Apr 2000
    Location
    Sao Paulo - Brazil
    Posts
    709

    A form can't be moved or sized while minimized or maximized

    Hi

    I did a simply change in form_resize, now some machine run work fine , but other show the error


    A form can't be moved or sized while minimized or maximized


    Form_Resize

    I changed

    Code:
        
            If Me.height < 6000 Or Me.width < 6000 Then
                Me.height = IIf(Me.height < 6000, 6000, Me.height)
                Me.width = IIf(Me.width < 6000, 6000, Me.width)
                Me.Refresh
                Exit Sub
            End If
    by


    Code:
        
          If Me.Height < 8550 Or Me.Width < 11430 Then
            Me.Visible = False
            Me.Height = IIf(Me.Height < 8550, 8550, Me.Height)
            Me.Width = IIf(Me.Width < 11430, 11430, Me.Width)
            Me.Refresh
           Me.Visible = True
            Exit Sub
          End If

  2. #2
    Frenzied Member
    Join Date
    Mar 2008
    Posts
    1,210

    Re: A form can't be moved or sized while minimized or maximized

    I guess this code runs inside a Form_Resize() Event, and you get the error when the Form is minimized.

    So try;
    Code:
    Private Sub Form_Resize()
    
        If WindowState <> vbMinimized Then
            If Height < 6000 Then Height = 6000: Exit Sub
            If Width < 6000 Then Width = 6000: Exit Sub
        End If
        
        'other code
        ''''''''''''
    End Sub
    Note:
    1) The Exit Subs whenever we resize the form because the Resize Event will fire again re-entrantly when that happens.
    2) The Me prefix to Form Properties is not normally required.
    3) Form Refresh should not be required

  3. #3
    Hyperactive Member
    Join Date
    Aug 2017
    Posts
    380

    Re: A form can't be moved or sized while minimized or maximized

    Did you not find any of the subclassing-based solutions in your previous thread satisfactory? FYI, none of them is flicker-prone unlike the simplistic approach you've shown.

  4. #4
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    10,915

    Re: A form can't be moved or sized while minimized or maximized

    Any software I post in these forums written by me is provided "AS IS" without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. To all, peace and happiness.

Tags for this Thread

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