The information in this article applies to:
SYMPTOMS
Setting the MaxButton property of a form to False removes the Maximize item
in the Control-menu box and removes the maximize button in the upper right
corner of the form. However, double-clicking the title-bar still maximizes
the form or toggles back to the default size. CAUSEBy default, double-clicking the title bar has the same effect as choosing Maximize or Restore from the Control-menu box -- it acts as a toggle between the normal window size and the maximized window size. This behavior is by design in standard Microsoft Windows. Setting the MaxButton property of the form to False fails to suppress this behavior in Visual Basic version 2.0. WORKAROUNDTo prevent a double-click on the title bar from causing Maximize or Restore, call Windows API functions as shown in the sample program in the More Information section below. STATUSMicrosoft has confirmed this to be a problem in Visual Basic version 2.0 for Windows. This problem was corrected in version 3.0. In version 3.0, setting the form's MaxButton property to False correctly ignores double- clicks on the title bar. MORE INFORMATIONThe default Control-menu box in the upper left-hand corner of a Visual Basic form contains the following nine entries including separators: RestoreThese are numbered 0 through 8 from the top down. You may remove any or all entries. Be sure to remove items in reverse sequence, from 8 to 0, or else the numbering will become confused. NOTE: To remove the Control-menu box, set the ControlBox property to False. To remove the minimize button, set the MinButton property to False. To remove the maximize button, set the MaxButton property to False. Steps to Work Around the BehaviorThe following program removes the Maximize feature from a Visual Basic form. This code can be used in Visual Basic versions 2.0 and 3.0.
Clicking the Minimize arrow or choosing the Minimize menu item minimizes the form to an icon. A single-click on that icon does not open a control menu, unlike normal Visual Basic application icons. A double-click is required to restore the form to its full-screen state. NOTE: In the above program, the following Form properties should be left with their design-time default: ControlBox = True, MaxButton = True, MinButton = True. The API functions take care of any necessary property changes. REFERENCES"PC Magazine's Visual Basic Programmer's Guide to the Windows API" by Daniel Appleman (of Desaware), published by Ziff-Davis Press, pages 414 and 418. This reference describes most Windows API functions that can be used from within Visual Basic. Additional query words: buglist2.00 fixlist3.00 2.00
Keywords : PrgOther |
Last Reviewed: September 17, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |