如何隐藏 TRadioGroup 周围的边框
我在 TRadioGroup 中有两个单选按钮。它们应该如何工作背后的所有逻辑都很好。但是 TRadioGroup 控制器周围有一个框架,我认为我可以使用 border 属性或类似的属性来删除它。但该控件似乎没有任何与边框/框架类似的属性。如何将控制器设置为不包含框架?
I have two radiobuttons in a TRadioGroup. All the logic behind how they are supposed to work is fine. But the TRadioGroup controler has a frame around it that I thought I would be able to delete using a border property or something like that. But the control doesn't seem to have any property that bears any resemblance to a border/frame. How do I set the controler to not include a frame?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我认为您无法隐藏标准无线电组框上的边框。看起来您可以创建一个自定义后代并在正常绘制的情况下覆盖绘画,但这种方法可能更多地涉及主题支持。总的来说,走这条路听起来需要做很多工作。
下一个最明显的方法是用容器(例如面板)上的许多单独的单选按钮来替换单选按钮组。这可以工作并且代码很简单,但可能会变得混乱。似乎很多忙碌的工作收效甚微,我也懒得去寻找其他选择。
您可以使用一个拼凑的东西。如果将单选按钮组放在面板上而不是直接放置在表单(或其他背景)上,则可以使面板尺寸小于单选按钮组。您希望面板与收音机组的内部一样大,但不与边框一样大。然后将单选组的顶部和左侧设置为负数,以便边框落在父面板之外。这样边界是不可见的。
I don't think you can hide the border on a standard radio group box. It looks like you could create a custom descendant and override the painting if drawing normally, but that approach could be a bit more involved with theme support. Overall it sounds like a lot of work to go that route.
The next most obvious approach is to replace the radio group with a number of individual radio buttons on a container such as a panel. That would work and would be simple code but it could get messy. It seems a lot of busy work for little gain and I am lazy enough to look for another option.
There is a kludge you can use. If you put the radio group on a panel rather than directly onto the form (or other background) you can make the panel under-sized compared to the radio group. You want the panel to be as big as the interior of the radio group but not as big as the border. Then set the top and left of the radio group to negative numbers so that the border falls outside the parent panel. The border is not visible this way.
TRadioGroup
不支持您正在寻找的内容。将两个TRadioButton
组件放置到TPanel
上。然后你就可以把它变成你想要的样子。TRadioGroup
does not support what you are looking for. Place twoTRadioButton
components onto aTPanel
instead. Then you can make it look how you want.我知道这不是最佳实践,但我遇到了类似的问题,无法重新设计所有内容。所以我这样做只是为了隐藏边框(到目前为止效果很好)。
I know it's not best practice but I had a similar issue and couldn't redesign everything. So I did this to simply hide the border (and works great so far).