.net tabcontrol 选项卡大小
我有一个选项卡控件,我在其中使用用户绘画来消除闪烁。它在消除闪烁方面渲染得很好,但选项卡宽度不正确。文本周围有大量的填充,随着选项卡上文本长度的增加,填充也会变大。这就像选项卡的宽度基于比正在绘制的字体更大的字体。我尝试更改选项卡控件上的字体大小,但这对选项卡宽度没有影响。
选项卡控件如何确定选项卡的宽度?有什么我可以覆盖的,以便我可以向选项卡控件提供选项卡宽度?
I have a tab control where I'm using user painting to remove flickering. It's rendering fine in terms of flicker removal, but the tab widths are not right. There is a large amount of padding around the text that gets bigger as the length of the text on the tab increases. It's like the width of the tab is based on a font that is larger than the one that is being drawn. I have tried changing the size of the font on the tab control, but that has no effect on the tab widths.
How does the tab control determine the widths of the tabs? Is there something I can override so that I can supply the tab widths to the tab control?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
要更改选项卡大小,您必须执行 Ian 所说的操作(在 ItemSize 中设置所需大小)并将 SizeMode 属性设置为固定
To change the tab size you must to do what said Ian (set required size in ItemSize) and set SizeMode property to Fixed
在使用自定义绘画之前,您是否尝试过启用双缓冲来消除闪烁?
只需尝试在控件构造函数中调用此函数,看看它是如何工作的:
Have you tried to enable double buffering to remove the flicker before using custom painting?
Just try to call this function in your control constructor and see how it works:
TabControl 有一个名为 ItemSize 它确实用于通知 TabControl 关于其选项卡的大小。
The TabControl has a property called ItemSize which is indeed used to inform the TabControl as to the size of its tabs.