Microsoft Knowledge Base Article
This article contents is Microsoft Copyrighted material.
©2005-©2007 Microsoft Corporation. All rights reserved.
Terms
of Use |
Trademarks
Article ID: 905721 - Last Review: May 21, 2007 - Revision: 1.3
The text on a TabControl control may not be displayed in the .NET Framework 1.1
On This Page
SYMPTOMS
In the Microsoft .NET Framework 1.1, the text on a
TabControl control may not be displayed when the following conditions are
true:
- You use a Windows Forms application.
- You use a TabControl control in the application.
- You try to align the TabControl control on the left or on the right.
- You enable visual styles for the application by using the EnableVisualStyles method.
CAUSE
This behavior occurs because of a limitation of the
TabControl control in Microsoft Common Control 6.0.
WORKAROUND
To work around this behavior, use one of the following methods.
Method 1
Disable visual styles for the application by removing the call to the
EnableVisualStyles method.
Method 2
Set the
DrawMode property of the
TabControl control to the
OwnerDrawFixed value. Additionally, add custom code to draw the tabs.
For more information, visit the following Microsoft Developer Network (MSDN) Web site:
MORE INFORMATION
Steps to reproduce the behavior
- Start Microsoft Visual Studio .NET 2003.
- Use Microsoft Visual Basic .NET 2003 to create a Windows Forms
application. Name the application myTabControl, and then
click OK.
- Add a TabControl control to Form1.
- In the
designer for Form1, right-click the TabControl control, and then click Add
Tab.
- Perform step 4 three times to add three tabs
on the TabControl control.
- In Solution Explorer, right-click
Form1.vb, and then click View Code to open
the code view.
- In the definition of TabControl1, add the following code.
Me.TabControl1.Alignment = TabAlignment.Right
- In the definition of TabPage1, use the following code to
add text.
Me.TabPage1.Text = "Any Text"
- To reproduce the behavior, you must call the EnableVisualStyles method in the Main function. Use code that is similar to the following before the "Public Sub New()" code block.
Public Shared Sub Main()
System.Windows.Forms.Application.EnableVisualStyles()
System.Windows.Forms.Application.Run(New Form1)
End Sub - On the Project menu, click
myTabControl Properties, click Sub Main in the Startup object list, and then click OK.
- On the Debug menu, click Start.
REFERENCES
For more information, visit the following MSDN Web
site:
APPLIES TO
- Microsoft .NET Framework 1.1
Community Feedback System
Very often, it takes hours to solve a problem. Very often, you've looked high
and low, and have tried a lot of solutions. When you finally found it, chances
are, it was because someone else helped you. Here's your chance to give back.
Use our community feedback tool to let others know what worked for you and what
didn't.
Please also understand that the community feedback system is not warranted to be
correct, it's simply a system that we've built to let people try and help each
other. If something in a feedback response doesn't make sense to you, or you're
not comfortable making changes that the feedback talks about (like registry
edits), please consult a professional.
Thank you for using kbAlertz.com Feedback System.
-- Scott Cate
Be the first to leave feedback, to help others about this knowledge base
article.
(Optional) Name
(Optional)
Public URL Or Email
Comments
No
HTML -- Text Only Please