标签控件中的垂直文本将不会显示 [英] Vertical Text in a Tab Control Will Not Display

查看:56
本文介绍了标签控件中的垂直文本将不会显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个程序,该程序具有Windows窗体中的选项卡控件.该控件使用< code> Alignment = Left</code>属性以将选项卡垂直放置在控件的左边缘.当安装在多台XP计算机上(大多数是由Dell发行,有几台Lenovo)时,垂直文本在某些计算机上可以正确显示,而在其他计算机上则没有.我正在使用VB2005.

有人见过这种行为吗?关于原因有什么想法吗?

谢谢.

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.

推荐答案

我不确定这是否有帮助,但请访问
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.


基于Marcus Kramer提供的信息,我在MSDN库中找到了有关Tab Control Alignment属性的功能"的以下描述:
http://msdn.microsoft.com/en-us/library/system.windows.forms.tabcontrol.alignment.aspx [ ^ ]

这使我进入Windows API调用,该API选择和禁用(通过不选择主题)控件的主题: SetWindowTheme函数(^ )

我发现此解决方案必须应用于每个受苦的选项卡控件:

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:

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


这篇关于标签控件中的垂直文本将不会显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆