使用 ToggleButton 的 false .Value 删除单击时顶部的灰色
我试图使 ToggleButton
看起来始终是黑色的,但是当单击时,顶部总是出现这个灰色蒙版(可能是为了“单击”效果)
: sstatic.net/YKl34.png" rel="nofollow noreferrer">
我发现使用 ToggleButton
的 false
.Value
你可以删除它,但我的问题是现在用户表单我正在使出现在关闭后再次出现。有办法解决这个问题吗? 当您单击按钮时,这是我的子目录:
Private Sub ToggleButton1_Click()
ToggleButton1.Value = False
ToggleButton1.Caption = "Afficher l'interface"
ToggleButton1.ForeColor = RGB(255, 255, 255)
ToggleButton1.BackColor = RGB(0, 0, 0)
UF_Interface.Show 'Userform I want to show when you click the button
End Sub
谢谢
I'm trying to make a ToggleButton
look always black but when clicked there's always this grey mask appearing on top (probably for the "clicked" effect) :
I found that with the false
.Value
of the ToggleButton
you can remove it but my problem is now that the userform I'm making appear is appearing again once closed. Is there a way to fix that ?
This is my sub for when you click the button :
Private Sub ToggleButton1_Click()
ToggleButton1.Value = False
ToggleButton1.Caption = "Afficher l'interface"
ToggleButton1.ForeColor = RGB(255, 255, 255)
ToggleButton1.BackColor = RGB(0, 0, 0)
UF_Interface.Show 'Userform I want to show when you click the button
End Sub
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果我可以建议,如果您想使用切换按钮,
也许最好设置两个条件(如果 true 那么什么,如果 false 那么什么),
如下图所示:
所以在上图中,如果 true 则打开另一个 UF -如果为假那么关闭那个UF。
下面是 ToggleButton 所在的 UF 中的代码:
两个用户窗体(UF_Interface 和带有切换按钮的窗体)都必须以
vbModeless
状态显示。所以你需要在常规模块中创建另一个子模块,如下所示:If I may suggest, if you want to use the ToggleButton,
maybe it's better making a two condition (if true then what, if false then what),
such as the image below :
So in the image above, if true then open the other UF - if false then close that UF.
Below is the code in the UF where the ToggleButton reside :
Both userforms (UF_Interface and the one with the toggle button) must be shown in
vbModeless
state. So you need to make another sub in regular module, something like below :在@karma的帮助下,我这样修改了我的代码(因为我无法更改“正常”按钮的颜色,即使我想要它的工作方式):
With the help of @karma I modified my code this way (since I couldn't change the color of a "normal"
Button
even though I wanted it's way of working) :