|
-
Mar 6th, 2006, 03:29 AM
#1
Thread Starter
Member
[RESOLVED] can I catch the Maxbutton event?
Hi there! First of all, this what I'm trying to do:
- I take the main form of my application, there's a command button to minimize/resize the form so there are only a toolbar-style form left.
- After switching to this toolbar mode, the user can switch back to maximized mode by clicking again on the button.
- o.k., this works so far. I've handled lots of the max/min/etc stuff by setting and removing maxbutton properties, so that there are no control box buttons in toolbar-mode.
- Now the Problem is: Application opens maximized, before i first click the toolbar button i can change between maximized size and - well - medium size (like half-sized). The user may not resize the form except by using maxbutton to switch between the two sizes. Now, if i change the form to toolbar and back, the new stored sizes on maxbutton are maximized and the size of the toolbar.
How can I catch the click event on the maxbutton, so I can set the form sizes myself? Or can I change these sizes anywhere?
Thanks for your time & help!
eugen
-
Mar 6th, 2006, 03:34 AM
#2
Re: can I catch the Maxbutton event?
VB Code:
Private Sub Form_Resize()
If Me.WindowState = vbMaximized Then
'
End If
End Sub
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 
-
Mar 6th, 2006, 03:41 AM
#3
Thread Starter
Member
Re: can I catch the Maxbutton event?
Thx for the quick reply! This line only defines what happens when the window maximizes, does it? I'd like to change the size when the form is changed to medium size...
-
Mar 6th, 2006, 03:48 AM
#4
Re: can I catch the Maxbutton event?
You need to restore the window to the normal window state so you can resize it.
VB Code:
Option Explicit
Private Sub Form_Resize()
If Me.WindowState = vbMaximized Then
Me.WindowState = vbNormal
Me.Height = 2000
Me.Width = 4000
End If
End Sub
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 
-
Mar 6th, 2006, 05:27 AM
#5
Thread Starter
Member
Re: can I catch the Maxbutton event?
Thanks again, found my error now. I used the wrong vbwindowstate cause I understood that one wrong. I was using the state I was leaving instead of the state I'm going to. Thanks for posting the code, thought it was exactly may stuff till I realized I messed up the windowstates. Further, I had to add a boolean that tells the application if it's in toolbar-mode, cause the i change the form to vbNormal when I turn it into a toolbar. Thx for quickly handling this!
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
|