Winforms TabControl对齐问题
当我将 TabControl 对齐设置为 Left
或 Right
时,它会在选项卡按钮和选项卡页面区域之间留下巨大的空间。如何摆脱这个无用的空间?
TabControl.Appearance
设置为 Buttons
,因为如果将其设置为 Normal
,按钮上的文本就会消失。
更新:
当我将 TabControl.Alignment
设置为 Bottom
并将 TabControl.Appearance
设置为 Normal
按钮看起来是倒置的(橙色线应该是如下)
当我将 TabControl.Alignment
设置为 Bottom
和 < code>TabControl.Appearance 到 Buttons
,TabPage
上没有放置控件的区域
When I set TabControl alignment to Left
or Right
it leaves this huge space between tab buttons and tab page area. How to get rid of this useless space?
TabControl.Appearance
is set to Buttons
because if it is set to Normal
the text on buttons disappear.
UPDATE:
When i set TabControl.Alignment
to Bottom
and TabControl.Appearance
to Normal
buttons look inverted (orange line should be below)
When i set TabControl.Alignment
to Bottom
and TabControl.Appearance
to Buttons
, There is no area on TabPage
to place controls
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是本机选项卡控件的 XP 视觉样式实现中的一个众所周知的问题,只有与顶部对齐的选项卡才能正确呈现。这个错误直到 Windows 7 才得到解决。解决方法是有选择地关闭该样式。将新类添加到您的项目中并粘贴下面所示的代码。编译。将新控件从工具箱顶部拖放到窗体上,然后根据您的喜好更改 Alignment 属性。它看起来不会比那更漂亮。
This is a well-known problem with the XP visual style implementation for the native tab control, only tabs aligned to the top render properly. This bug hasn't been addressed until Windows 7. The workaround is to selectively turn off the style. 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 and change the Alignment property to your liking. It isn't going to look prettier than that.
Microsoft 文档与此问题相关的备注
Microsoft documentation Remarks related to this issue