Toll Free: (877) 723-1442 U.S. and Canada
Support
ActiveX / COM
Visual C++ / MFC
Customer Spotlight
Corporate Partners
Contact Sales

Call center available M-F 9:00 - 6:00 US Eastern Time.

U.S. and Canada
(877) 723-1442

International
(517) 625-5729

Email

'Stretch' a Toolbar to Fill the Entire Width of the Application

Author: Mike Palmatier
Posted: October 21, 2005
Environment: Visual Basic 6.0

The CommandBars.EnableDocking method is used to apply the xtpFlagStretched flag from the XTPToolBarFlags enumeration. This will keep 'stretch' the toolbar the entire width (if horizontal) of the application, even when there are not enough buttons to fill the toolbar. With the xtpFlagStretched flag, no other toolbars can be docked on the same row. Note that this is the default setting given to the ActiveMenuBar.

The picture below illustrates a toolbar with hidden buttons.



If you would like to stretch a toolbar and also allow other toolbars to be docked on the same row you can use the xtpFlagStretchedShared flag.

The code below illustrates how to stretch a toolbar the entire width of the application.

 Dim ToolBar As CommandBar

 

 Set ToolBar = CommandBars.Add("Standard", xtpBarTop)

 ToolBar.EnableDocking xtpFlagStretched

Microsoft, Visual Studio, and the Visual Studio logo are trademarks or registered trademarks of Microsoft Corporation in the United States and/or other countries. Other products and/or company names may be trademarks or registered trademarks of their respective owners.