The text on a TabControl control may not be displayed in the .NET Framework 1.1 (905721)



The information in this article applies to:

  • Microsoft .NET Framework 1.1

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

  1. Start Microsoft Visual Studio .NET 2003.
  2. Use Microsoft Visual Basic .NET 2003 to create a Windows Forms application. Name the application myTabControl, and then click OK.
  3. Add a TabControl control to Form1.
  4. In the designer for Form1, right-click the TabControl control, and then click Add Tab.
  5. Perform step 4 three times to add three tabs on the TabControl control.
  6. In Solution Explorer, right-click Form1.vb, and then click View Code to open the code view.
  7. In the definition of TabControl1, add the following code.
    Me.TabControl1.Alignment = TabAlignment.Right
  8. In the definition of TabPage1, use the following code to add text.
    Me.TabPage1.Text = "Any Text"
  9. 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
  10. On the Project menu, click myTabControl Properties, click Sub Main in the Startup object list, and then click OK.
  11. On the Debug menu, click Start.

Modification Type:MajorLast Reviewed:9/22/2005
Keywords:kbinfo kbprb KB905721 kbAudITPRO kbAudDeveloper