有没有办法让按钮在被选中时不绘制轮廓?
我构建了一个自定义控件,并且带有主题支持,看起来很奇怪。有什么方法可以使其始终在关闭主题的情况下进行绘制,即使应用程序是在主题支持打开的情况下构建的?
编辑:我找到了一种关闭主题的方法,但没有多大帮助。问题是它是一个从 TBitBtn 派生的特殊按钮,每当选择该按钮时,它都会尝试用虚线在其周围绘制边框,这会妨碍操作。我怎样才能关闭它?
I built a custom control, and with theme support on it looks very strange. Is there any way to make it so that it will always draw with themes off, even if the application is built with theme support on?
EDIT: I found a way to turn theming off and it didn't help much. The problem is that it's a special button descended from TBitBtn, and whenever the button is selected, it tries to draw a border around it with a dotted line and that gets in the way. How can I turn that off?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以尝试复制 TBitBtn.DrawItem 的实现并根据您的需要进行调整。在代码中搜索 IsFocused 应该可以为您提供指导。
要调用修补后的代码,您还必须通过实现类似的消息处理程序来链接 CNDrawItem 方法。
You can try to copy the implementation of TBitBtn.DrawItem and tweak it to your needs. A search for IsFocused inside the code should give you a guide.
To call your patched code you also have to link in the CNDrawItem method by implementing a similar message handler.
您可以使用
UxTheme.pas
中的SetWindowTheme
函数禁用组件的主题,这将禁用按钮和进度条的主题
u can disable the theme for a component using the
SetWindowTheme
function found inUxTheme.pas
this will disable the theme for a button and a progressbar