单击时标签更改颜色 [英] Label change color when clicked

查看:83
本文介绍了单击时标签更改颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个VBA/Excel,用户单击标签(Active X-文本标签)以执行某些操作. label属性为BackStyle Transparent,但是当用户单击时,标签保持不透明,如白色或任何设置的BackColor属性.

I have a VBA/Excel that user clicks on labels (Active X - Text Label) to perform some actions. The label property is BackStyle Transparent, but when the user click, the label keep opaque, like white or whatever the BackColor property is set.

用户单击标签时如何保持透明?

How can I keep transparent when user click on the label?

推荐答案

请勿为此使用ActiveX控件.可以将任何Shape分配给宏,因此不必像这样对ActiveX标签使用Click事件处理程序:

Don't use an ActiveX control for this. Any Shape can be assigned to a macro, so instead of having Click event handlers for ActiveX labels like so:

Private Sub Label2_Click()
    'do stuff
End Sub

使处理程序公开,给他们一个有意义的名字:

Make the handlers public, give them a meaningful name:

Public Sub BuscaPorPalavraChave()
    'do stuff
End Sub

TextBox形状替换标签-使形状填充和边框透明,右键单击该形状,然后选择分配宏"-然后选择BuscaPorPalavraChavre.完成!

Replace the labels with TextBox shapes - make the shape fill and border transparent, right-click the shape, and select "assign macro" - then pick BuscaPorPalavraChavre. Done!

冲洗&对每个标签重复.我知道,很痛苦-但值得!

Rinse & Repeat for every label. I know, painful - but worth it!

该导航UI看起来非常不错,顺便说一句=)

That navigation UI looks very nice BTW =)

这篇关于单击时标签更改颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆