在不使用框架的情况下在 VBA 用户窗体上的控件周围绘制边框?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/16721265/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Draw border around controls on VBA Userform without using a Frame?
提问by Josh
I am designing a VBA UserForm (in Excel, if it is relevant) and I would like some controls to be visually grouped together.. but when I put them in a frame, I am getting some undesired results (part of it has to do with the RefEdit control which seems to be particularly unhappy inside a frame).
我正在设计一个 VBA 用户窗体(在 Excel 中,如果相关的话)并且我希望一些控件在视觉上组合在一起......但是当我把它们放在一个框架中时,我得到了一些不想要的结果(部分必须做使用 RefEdit 控件,它似乎在框架内特别不满意)。
Is there a way to draw a border around a group of controls on a form without putting them inside a Frame?
有没有办法在窗体上的一组控件周围绘制边框而不将它们放在框架中?
采纳答案by Doug Glancy
Use a label with the caption deleted and the border style set to fmBorderStyleSingle
. It may appear on top of your other controls, so right click on it and select "send backwards" until it's behind your other controls.
使用已删除标题且边框样式设置为 的标签fmBorderStyleSingle
。它可能会出现在您的其他控件的顶部,因此右键单击它并选择“向后发送”,直到它位于您的其他控件的后面。
回答by Richard Dougan
The best way to do this would be to create the shape over where you need it to be. Drag highlight everything that you want on top of it, then right click and brink it all forwards. Then when you drag your shape back over the top it will in fact be underneath everthing else. Hope that helps.
最好的方法是在你需要的地方创建形状。拖动突出显示您想要的所有内容,然后右键单击并将其全部向前移动。然后,当您将形状拖回到顶部时,它实际上将位于其他所有物体的下方。希望有帮助。