|
-
Jul 9th, 2007, 07:18 PM
#1
Thread Starter
Hyperactive Member
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...
Visual Basic Rules!!!!! 
-
Jul 9th, 2007, 07:28 PM
#2
Re: I need to make my form not resize to anything smaller than...
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 9th, 2007, 07:28 PM
#3
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?
-
Jul 9th, 2007, 07:36 PM
#4
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.
-
Jul 9th, 2007, 07:37 PM
#5
Thread Starter
Hyperactive Member
Re: I need to make my form not resize to anything smaller than...
would't that cause flickering?
Visual Basic Rules!!!!! 
-
Jul 9th, 2007, 07:42 PM
#6
Thread Starter
Hyperactive Member
Re: I need to make my form not resize to anything smaller than...
 Originally Posted by RobDog888
that crashed my app...
Visual Basic Rules!!!!! 
-
Jul 9th, 2007, 07:42 PM
#7
Re: I need to make my form not resize to anything smaller than...
No no flickering. Test it
-
Jul 9th, 2007, 07:43 PM
#8
Thread Starter
Hyperactive Member
Re: I need to make my form not resize to anything smaller than...
 Originally Posted by Hell-Lord
No no flickering. Test it 
yes yes flickering... just resize it smaller... it goes crazy...
Visual Basic Rules!!!!! 
-
Jul 9th, 2007, 07:47 PM
#9
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.
-
Jul 9th, 2007, 07:49 PM
#10
Thread Starter
Hyperactive Member
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
Visual Basic Rules!!!!! 
-
Jul 9th, 2007, 07:49 PM
#11
Re: I need to make my form not resize to anything smaller than...
O btw it should be
instead of
in the code
-
Jul 9th, 2007, 07:52 PM
#12
Re: I need to make my form not resize to anything smaller than...
 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 It might be your computer.
-
Jul 9th, 2007, 07:53 PM
#13
Thread Starter
Hyperactive Member
Re: I need to make my form not resize to anything smaller than...
Visual Basic Rules!!!!! 
-
Jul 9th, 2007, 07:56 PM
#14
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
-
Jul 9th, 2007, 09:54 PM
#15
Re: I need to make my form not resize to anything smaller than...
 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.
-
Jul 9th, 2007, 10:19 PM
#16
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.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jul 11th, 2007, 07:01 PM
#17
Thread Starter
Hyperactive Member
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
Visual Basic Rules!!!!! 
-
Jul 11th, 2007, 07:34 PM
#18
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
-
Jul 11th, 2007, 07:55 PM
#19
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.
-
Jul 11th, 2007, 08:21 PM
#20
Thread Starter
Hyperactive Member
Re: I need to make my form not resize to anything smaller than...
I removed that and it crashes...
Visual Basic Rules!!!!! 
-
Jul 11th, 2007, 08:44 PM
#21
Re: I need to make my form not resize to anything smaller than...
 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.
-
Jul 12th, 2007, 11:37 AM
#22
New Member
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
-
Jul 12th, 2007, 04:42 PM
#23
Frenzied Member
Re: I need to make my form not resize to anything smaller than...
 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.
-
Jul 12th, 2007, 05:30 PM
#24
Banned
Re: I need to make my form not resize to anything smaller than...
 Originally Posted by vbman213
I removed that and it crashes...
i believe this is a bugs
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
|