SWT 中 CTabFolderRenderer 中的关闭按钮 [英] Close button in CTabFolderRenderer in SWT
问题描述
我要求在 CTabFolder
中有一个关闭 Button
(Native) 以进行关闭操作.准确地说,我需要一个带有文本close"的本机按钮.我有一个 CustomCTabFolderRenderer
,其中 drawClose
方法被覆盖.我确实设法绘制了图像,但客户不喜欢那样.有没有办法绘制原生按钮,而不是使用 GC
绘制任何多边形或图像?我本可以用一些文字绘制一个矩形,但我担心它不能提供原生外观.即使我能得到一个绘制 Windows 操作系统 按钮的解决方案(我的意思是任何仅适用于 Windows 的实现)
I have a requirement to have a close Button
(Native) in CTabFolder
for close action. To say precisely I need a native Button with text "close".
I have a CustomCTabFolderRenderer
with drawClose
method being overidden. I did manage to draw an image, but client didn't like that. Rather than drawing any polygon or image using the GC
is there any way to draw a native Button? I could have drawn a rectangle with some text, but I'm worried that it cant give a native look. I would be pretty much happy even if I can get a solution to draw a Windows OS button(I mean any implentation that works just on windows)
推荐答案
据报道 这里,目前没有办法自己绘制原生操作系统资源,即SWT没有提供方法来做到这一点.
As reported here, there is currently no way to draw native OS resources yourself, i.e. SWT does not supply methods to do this.
此外,如果没有强大的伏都教力量,您就无法对 CTabFolder
进行子类化.
Furthermore, you can't subclass CTabFolder
without a great amount of voodoo power.
作为结论:没有简单"的方法可以做到这一点.如果可能的话,那将需要大量的工作.
As a conclusion: There is no "easy" way to do this. If it is possible, it would require a lot of work.
这篇关于SWT 中 CTabFolderRenderer 中的关闭按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!