问题描述
我想使用选项卡控件并将选项卡显示在左侧而不是顶部.我已将对齐设置为左侧,选项卡显示在那里.但是,如何使文本垂直显示在选项卡上?我查看了 msdn,它给出了一个左对齐选项卡控件的示例,但选项卡标签仍然水平显示!
I want to use a tab control and have the tabs displayed on the left, as opposed to at the top. I have set the alignment to the left and the tabs are displayed there. However, how do I get the text to be displayed on the tab, vertically? I have looked at the msdn and it gives an example of a left aligned tab control but the tab label is still displayed horisontally!
另一件事,有人知道如何使用带有默认布局的左对齐选项卡的选项卡控件以使其看起来更好吗?
The other thing, does anybody know how to use the tab control with left aligned tabs with the default layout so that it looks better?
请不要使用第三方应用,除非它们是免费的,是的,我已经看过代码项目了.
Please no third party apps unless they are free, and yes I have looked at code project already.
谢谢,R.
推荐答案
这是原生 Windows 选项卡控件的视觉样式渲染器中的一个古老错误.它只支持顶部的选项卡,我猜,负责它的微软程序员在完成工作之前被一辆公共汽车碾过.
It is an age-old bug in the visual styles renderer for the native Windows tab control. It only supports tabs at the top, the Microsoft programmer that worked on it was run over by a bus before she could finish the job, I guess.
您唯一能做的就是有选择地关闭控件的视觉样式.向您的项目添加一个新类并粘贴如下所示的代码.编译.将新控件从工具箱顶部拖放到表单上,替换原来的控件.
The only thing you can do about it is selectively turn off visual styles for the control. Add a new class to your project and paste the code shown below. Compile. Drop the new control from the top of the toolbox onto your form, replacing the original.
using System;
using System.Windows.Forms;
using System.Runtime.InteropServices;
public class FixedTabControl : TabControl {
[DllImportAttribute("uxtheme.dll")]
private static extern int SetWindowTheme(IntPtr hWnd, string appname, string idlist);
protected override void OnHandleCreated(EventArgs e) {
SetWindowTheme(this.Handle, "", "");
base.OnHandleCreated(e);
}
}
这篇关于选项卡控件,垂直对齐的选项卡与垂直对齐的文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!