是否可以控制 JvDockServer 组件中选项卡的显示方式?
如果您在 JVCL 的 JvDocking 示例代码中运行 AdvanceDemo,并选择 VSNetStyle,则可以将第二个窗体拖到主窗体上;将显示带有第二个表单标题的选项卡。如果您随后将另一个表单拖到主表单的同一侧,则会创建另一个选项卡。两个选项卡将重叠:
有没有办法控制这两个选项卡重叠的程度?我希望选项卡足够分开,以便用户可以阅读两个选项卡上的文本。
一如既往地感谢——Al C.
If you run the AdvanceDemo in the JVCL's JvDocking example code, with VSNetStyle selected, you can drag a second form onto the main form; a tab with the second form's title will be displayed. If you then drag a another form onto the same side of the main form, another tab will be created. The two tabs will overlap:
Is there a way to control how much these two tabs overlap? I'd like the tabs to be separated enough so that users can read the text on both tabs.
Thanks, as always -- Al C.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
正如艾因评论的那样,我也认为这是一个错误。更准确地说,TJvDockVSChannel.Paint 中绘制选项卡的错误(选项卡内部称为块)。这样的块有一个受保护的属性InactiveBlockWidth,其名称表明控制其宽度。
该属性对于选项卡本身工作正常,但标题在 TJvDockVSChannel.Paint 中再次移动相同的量,在我看来这就是问题所在。
您可以通过分配 DockServer 的 OnFinishSetDockPanelSize 事件进行如下实验:
由于目前这是受保护的属性,因此它可能表明其功能正在构建中。我想 Jedi 的开发团队现在决定只绘制每个非活动选项卡的字形,因为缺乏动态处理选项卡宽度的完整实现。例如,您应该能够设置每个选项卡的最小宽度,并且当栏(即它所在的容器)改变高度时,所有选项卡都应相应地变宽或变窄。
编辑:
由于灵活的设计,您可以通过设置 DockServer 的 DockPanelClass 属性来解决该错误。我认为必须在设置 Style 属性之前设置该属性。它涉及重写整个 Paint 例程,因为 InactiveBlockWidth 也在 GetBlockRect 中使用,而 GetBlockRect 又不是虚拟的:
As ain commented, I also think it is a bug. More precisely a bug in TJvDockVSChannel.Paint which draws the tabs (internally the tabs are called blocks). Such a block has a protected property InactiveBlockWidth whose name suggest controlling its width.
The property works fine for the tab itself, but the caption is shifted by that same amount again in TJvDockVSChannel.Paint, which seems to me to be the problem.
You can experiment as follows, by assigning the OnFinishSetDockPanelSize event of the DockServer:
Since this is a protected property for now, it might indicate its functionality being under construction. I suppose Jedi's dev team have decided for now to draw only the glyph of each inactive tab, because there lacks a full implementation for dynamic handling of the tab widths. E.g. you should be able to set a minimum width of each tab, and when the bar (i.e. the container in which it resides) changes height, all tabs should widen or narrow accordingly.
Edit:
Thanks to the flexible design, you can work around the bug by setting the DockPanelClass property of the DockServer. I suppose that property has to be set befóre setting the Style property. It involves rewriting the whole Paint routine, because InactiveBlockWidth is also used in GetBlockRect, which in turn is not virtual: