-
I need to make my form not resize to anything smaller than...
basicly what I need is to make it so my form cant get any smaller than 11640 width X 6105 height but can resize to any size bigger...
-
Re: I need to make my form not resize to anything smaller than...
-
Re: I need to make my form not resize to anything smaller than...
Would it be a problem if it couldn't be made bigger?
-
Re: I need to make my form not resize to anything smaller than...
vb Code:
Private Sub Form_Resize()
If Me.Width <= 11640 And Me.Height <= 6105 Then
Me.Width = 11640
Me.Height = 6105
End If
End Sub
Try that.
-
Re: I need to make my form not resize to anything smaller than...
would't that cause flickering?
-
Re: I need to make my form not resize to anything smaller than...
Quote:
Originally Posted by RobDog888
that crashed my app...
-
Re: I need to make my form not resize to anything smaller than...
No no flickering. Test it ;)
-
Re: I need to make my form not resize to anything smaller than...
Quote:
Originally Posted by Hell-Lord
No no flickering. Test it ;)
yes yes flickering... just resize it smaller... it goes crazy...
-
Re: I need to make my form not resize to anything smaller than...
No doesn't do that for me, it just jumps straight away to the smallest size allowed. No consistent flickering. However i will test the code in rob's link and see how that compares.
-
Re: I need to make my form not resize to anything smaller than...
ok do this take an resize the form to the smallest size you can get it then let go of the mouse and while you do that you can see the flickering
-
Re: I need to make my form not resize to anything smaller than...
O btw it should be
instead of
in the code :)
-
Re: I need to make my form not resize to anything smaller than...
Quote:
Originally Posted by vbman213
ok do this take an resize the form to the smallest size you can get it then let go of the mouse and while you do that you can see the flickering
No flickering at all for me, it just goes immediately back to the smallest allowed size and thats it :D It might be your computer.
-
Re: I need to make my form not resize to anything smaller than...
-
Re: I need to make my form not resize to anything smaller than...
I tested the code in the link, it works well. I would probably use it over mine :) Have a look at it ;)
-
Re: I need to make my form not resize to anything smaller than...
Quote:
Originally Posted by vbman213
that crashed my app...
Before you subclass make sure there are no other sources of error in your source code or handle them accordingly.
-
Re: I need to make my form not resize to anything smaller than...
Yes, the link I posted used subclassing so you can not stop the program from running by pressing the stop button on the VB IDE or it will crash your app. You need to press your close button or the 'x' close button.
You can modify the faq code to do whatever you want as it uses subclassing there will be absolutely no flickering.
-
Re: I need to make my form not resize to anything smaller than...
Ok thanks so much... now I have one more question...
the lines of that code that are the const. for the max width and height... how can I calculate that with the current users screen size so it will maximize properly or how can I just disable the Max_width, Max_Height
-
Re: I need to make my form not resize to anything smaller than...
Just remove the sections of code concerned with Max Width/Height, the form will maximize correctly
-
Re: I need to make my form not resize to anything smaller than...
If your computer is set to show windows contents while dragging, it triggers the form paint event constantly while resizing the window. Perhaps that is why some people are seeing flickering and others are not.
-
Re: I need to make my form not resize to anything smaller than...
I removed that and it crashes...
-
Re: I need to make my form not resize to anything smaller than...
Quote:
Originally Posted by vbman213
I removed that and it crashes...
You do have to be careful when sub classing
Did you remove
Code:
'Keep the form only as wide as MAX_WIDTH
If (r.RIGHT - r.Left > MAX_WIDTH) Then
Select Case wParam
Case WMSZ_LEFT, WMSZ_BOTTOMLEFT, WMSZ_TOPLEFT
r.Left = r.RIGHT - MAX_WIDTH
Case WMSZ_RIGHT, WMSZ_BOTTOMRIGHT, WMSZ_TOPRIGHT
r.RIGHT = r.Left + MAX_WIDTH
End Select
End If
'Keep the form only as tall as MAX_HEIGHT
If (r.Bottom - r.Top > MAX_HEIGHT) Then
Select Case wParam
Case WMSZ_TOP, WMSZ_TOPLEFT, WMSZ_TOPRIGHT
r.Top = r.Bottom - MAX_HEIGHT
Case WMSZ_BOTTOM, WMSZ_BOTTOMLEFT, WMSZ_BOTTOMRIGHT
r.Bottom = r.Top + MAX_HEIGHT
End Select
End If
because thats what I meant and it works for me.
-
Re: I need to make my form not resize to anything smaller than...
The other way around is to put the resize command at Mouse Up event. So let the user resize the window as they like but once the Mouse up event occurs, it will be back to the desired size.
At lease there will no flickering, i promise
:wave:
-
Re: I need to make my form not resize to anything smaller than...
Quote:
Originally Posted by Hell-Lord
O btw it should be
instead of
in the code :)
Would it not be better to use two seperate if statements like this:
vb Code:
Private Sub Form_Resize()
If Me.Width < 11640 Then Me.Width = 11640
If Me.Height < 6105 Then Me.Height = 6105
End Sub
This way it means that the width can be reset while leaving the height alone and vice versa.
-
Re: I need to make my form not resize to anything smaller than...
Quote:
Originally Posted by vbman213
I removed that and it crashes...
i believe this is a bugs :eek: