Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Handling Minimizing and maximizing a form

Posted on 1999-07-13
9
Medium Priority
?
236 Views
Last Modified: 2010-05-02
Is there a quick way to reset the controls on your form to look good when the user min/maximizes it?
0
Comment
Question by:gpts
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 1

Expert Comment

by:Jaysin28
ID: 1524405
If you have a lot of controls on the form it would help if they were control arrays.  Refresh, works pretty good, refresh before the minimze/maximize.,
0
 

Author Comment

by:gpts
ID: 1524406
Could you be a little more specific?  I've tried doing the formname.refresh on formname_resize()....should I be changing the left positions of the control arrays?  
0
 
LVL 1

Expert Comment

by:Jaysin28
ID: 1524407
Yes...

You need to figure out (mathematically) how to place your controls on your form based upon the size of the form.
I can't really provide a concrete answer to this since I don't know what the form looks like.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:gpts
ID: 1524408
what action is fired by the minimize/maximize buttons?  Do I have to change the left position of the control arrays?
0
 
LVL 2

Expert Comment

by:BeedleGuis
ID: 1524409
there are third party controls to take care of this for you, not all work very well though.
0
 

Author Comment

by:gpts
ID: 1524410
Thank you.
0
 
LVL 7

Expert Comment

by:Vbmaster
ID: 1524411
Or u could just simply subclass the form and fetch the MIN and MAX messages sent to the window and act from that... you can read about subclassing at:

http://www.vbaccelerator.com

Yes, i post this site a lot but it's really good with source code for a couple of .OCX's =)
0
 
LVL 8

Accepted Solution

by:
mrmick earned 210 total points
ID: 1524412
When the min/max buttons are clicked, the resize event is fired.  Place a call to a procedure or code in there to handle redrawing the controls in question.

Inside the event procedure (or anywhere in the form code), you can determine the current state of the form by checking the "WindowState" property of the form.

Sample code:

   Select Case Me.WindowState
      Case vbMinimized
         MsgBox "Min Clicked"
      Case vbMaximized
         MsgBox "Max Clicked"
      Case vbNormal
         MsgBox "Normal"
   End Select

Note: In redrawing your form, you can use the Width & Height properties of the form to determine the current size of the form and use it to change control placement through the Left & Top properties of the controls in question.  You can also adjust the size of the controls through their Width and Height properties.
0
 

Author Comment

by:gpts
ID: 1524413
Thanks for everyone's help!
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
This article describes how to use a set of graphical playing cards to create a Draw Poker game in Excel or VB6.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question