Microsoft KB Archive/137623

= PRB: Align Property Setting Causes Toolbar to Fill the Form =

Article ID: 137623

Article Last Modified on 11/18/2003

-

APPLIES TO


 * Microsoft Visual Basic 4.0 Standard Edition
 * Microsoft Visual Basic 4.0 Professional Edition
 * Microsoft Visual Basic 4.0 Enterprise Edition

-



This article was previously published under Q137623



SYMPTOMS
When you change the align property to the left or right position, the control's width stays the same, the height changes to the height of the form, and the control becomes aligned with the desired side.



CAUSE
This is by design. All controls that have an align property behave like This. This includes the 3D panel, ProgressBar, StatusBar, and Toolbar controls.

The toolbar control's default align setting is top, so in this case, the toolbar's width is the width of the form. When you change the align property to the left or right, the width stays the same (form's width), and the height becomes equal to the form. As a result, the toolbar takes up the entire form.



RESOLUTION
To work around this in code, you must set the width or height to the values you want when you change the align property. In addition, You might want to change the toolbar's BorderStyle property to 1-fixed single to make the toolbar border more visible.



STATUS
This behavior is by design.



Steps to Reproduce Behavior
 Create a new project in Visual Basic. Form1 is created by default. Add a command button and a toolbar to Form1.  Place the following code in the command button click event: Private Sub Command1_Click If Toolbar1.Align < 4 Then Toolbar1.Align = Toolbar1.Align + 1 Else Toolbar1.Align = 0 End If  End Sub  Change the toolbar's BorderStyle property to 1-fixed single. Run the program, and click the command button twice. The toolbar moves from top to bottom. Then it moves from bottom to the entire screen. All the other controls on the form are hidden from view.</li></ol>

Additional query words: 4.00 vb4win vb4all

Keywords: kbprb KB137623

-

[mailto:TECHNET@MICROSOFT.COM Send feedback to Microsoft]

© Microsoft Corporation. All rights reserved.