|
-
Feb 23rd, 2018, 12:56 PM
#1
Thread Starter
Fanatic Member
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
  
-
Feb 23rd, 2018, 01:39 PM
#2
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
-
Feb 23rd, 2018, 02:53 PM
#3
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.
-
Feb 23rd, 2018, 08:44 PM
#4
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|