BUG: Toolbar Buttons Show No Text or Images If ButtonSize and Font Properties Set After Buttons Added To Toolbar (327154)
The information in this article applies to:
- Microsoft Visual Studio .NET (2002), Professional Edition
- Microsoft Visual Studio .NET (2003), Professional Edition
- Microsoft Visual Studio .NET (2002), Enterprise Architect Edition
- Microsoft Visual Studio .NET (2003), Enterprise Architect Edition
- Microsoft Visual Studio .NET (2002), Enterprise Developer Edition
- Microsoft Visual Studio .NET (2003), Enterprise Developer Edition
- Microsoft Visual Studio .NET (2002), Academic Edition
- Microsoft Visual Studio .NET (2003), Academic Edition
This article was previously published under Q327154 SYMPTOMS When you customize the buttons in a toolbar by changing the
ButtonSize and Font properties of the toolbar control in the IDE, the text and images
do not appear on the toolbar buttons at run time, although they appear correct
at design time. CAUSE When you set the ButtonSize and Font properties after the ToolBar.Buttons.AddRange method is called, those properties do not take effect, and text
and images do not appear on the buttons. RESOLUTION To work around this problem, follow these steps:
- Expand the "Windows Form Designer generated code" section
in the code view of the form.
- Expand the private void InitializeComponent() method and look for a statement similar to the following:
ToolBar.Buttons.AddRange(...);
- Paste that statement of code at the end, after all of the
properties of that ToolBar control have been set.
- Build and run the application.
Note Because the IDE generates the code that causes the problem, any
changes that you make in the IDE, such as adding new controls or events, cause
the IDE to regenerate the code, so the statement that causes the problem
returns to its original location. Therefore, every time that you build and test
the application, check the code file to make sure that ToolBar.Buttons.AddRange(...); has been moved to the end.
STATUSMicrosoft has confirmed that this is a bug in the Microsoft
products that are listed at the beginning of this article.
Modification Type: | Minor | Last Reviewed: | 8/28/2005 |
---|
Keywords: | kbvs2002sp1sweep kbbug kbCtrl kbnofix kbToolbar KB327154 |
---|
|