Click here to Skip to main content
15,887,676 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a program which has a tab control in a Windows form. This control uses the <code>Alignment = Left</code> property to place the tabs vertically at the left edge of the control. When installed on a number of XP computers (mostly by Dell, with a few Lenovo), the vertical text displays correctly on some, but is missing on others. I am using VB2005.

Has anyone seen this behavior before? Any ideas regarding the cause?

Thank you.
Posted

I'm not sure if this will help, but at this link, I found this.

The VB2005 app is themed and the VB6 one is not, am I right?
Timo Kunze posted on Tuesday, July 31, 2007 5:11 PM

The VB2005 app is themed and the VB6 one is not, am I right?
On Windows XP, vertical tab alignment isn't supported if the control is
themed.
 
Share this answer
 
Comments
Jalapeno Bob 3-Feb-11 17:35pm    
This might explain why it does NOT display on some, but why does the text display correctly on other XP machines?
fjdiewornncalwe 4-Feb-11 17:28pm    
It could mean that some machines have a theme applied at the OS level, and others do not.
Based on the information supplied by Marcus Kramer, I found the following description of a "feature" regarding the Tab Control Alignment attribute in the MSDN library:

http://msdn.microsoft.com/en-us/library/system.windows.forms.tabcontrol.alignment.aspx[^]

This lead me to a Windows API call which selects and disables (by selecting no theme) themes for controls: SetWindowTheme Function(^)

I found that this solution must be applied to each afflicted tab control:

VB
Public Class Form1

    Public Declare Unicode Function SetWindowTheme Lib "uxtheme.dll" (ByVal hWnd As IntPtr, _
        ByVal pszSubAppName As String, ByVal pszSubIdList As String) As Integer

    Private Sub Form1_Load(ByVal sender As System.Object, _
            ByVal e As System.EventArgs) Handles MyBase.Load
        Dim sb As String = String.Empty
        Dim v As String = String.Empty

        If Environment.OSVersion.Version.Major = 5 And _
                Environment.OSVersion.Version.Minor = 1 Then
            SetWindowTheme(Me.TabControl1.Handle, " ", " ")
        End If

    End Sub     ' Form1_Load
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900