C#垂直制表符控件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8991507/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
C# vertical tab control
提问by Rocshy
Can I make a tab control to look like the attached picture? I managed to add a tab control, but the text is still vertical. And I would want it to be horizontal.
我可以使选项卡控件看起来像附加图片吗?我设法添加了一个选项卡控件,但文本仍然是垂直的。我希望它是水平的。


采纳答案by Lloyd
There is an MSDN article about how to achieve this. How to: Display Side-Aligned Tabs with TabControl
有一篇关于如何实现这一点的 MSDN 文章。如何:使用 TabControl 显示侧对齐的选项卡
The following procedure shows how to render right-aligned tabs, with the tab text running from left to right, by using the "owner draw" feature.
以下过程显示了如何使用“所有者绘制”功能呈现右对齐的选项卡,其中选项卡文本从左到右运行。
回答by silverspoon
回答by MyHealingLife
i think this is default selected color
我认为这是默认选择的颜色
private void tabControl1_DrawItem(Object sender, System.Windows.Forms.DrawItemEventArgs e)
{
...
if (e.State == DrawItemState.Selected)
{
// Draw a different background color, and don't paint a focus rectangle.
_textBrush = new SolidBrush(Color.Black);
g.FillRectangle(Brushes.White, e.Bounds);
}
else
{
_textBrush = new System.Drawing.SolidBrush(e.ForeColor);
g.FillRectangle(Brushes.WhiteSmoke, e.Bounds);
}
...

