在 VISIO VBA 中设置图像透明度
我只是想就我遇到的问题请求帮助。我不知道我是否在做以下正确的事情,所以希望得到您最友善的指导。
我在 MS visio 中设置了一个 activeX 切换按钮,我试图用它来控制我放置在同一页面中的图像。
我想做的是,当按下切换按钮时,图像透明度将为 100,未按下时,图像透明度将为 0。
下面是我的代码,但由于某种原因,它不会对图像执行任何操作。我已经从形状表中检查了图像的名称。
预先感谢您对此提供的任何帮助和指导。
Private Sub ToggleButton1_Click()
Dim shp As Visio.Shape
If Me.ToggleButton1.Value = True Then
Set shp = Application.ActiveDocument.Pages("Page-1").Shapes("Sheet.1")
shp.CellsSRC(visSectionObject, visRowImage, visImageTransparency).FormulaForceU = "100"
ElseIf Me.ToggleButton1.Value = False Then
Set shp = Application.ActiveDocument.Pages("Page-1").Shapes("Sheet.1")
shp.CellsSRC(visSectionObject, visRowImage, visImageTransparency).FormulaForceU = "0"
End If
End Sub
I would just like to request assistance in relation to a concern that I experienced. I do not know if I am doing the below right so hoping for your kindest guidance.
I have setup an activeX toggle button in MS visio which I am trying to use to control an image that I have placed in the same page.
What I am trying to do is when the togglebutton is pressed the image transparency will be 100 and when it is not pressed it will be 0.
Below is my code, but for some reason it is not doing anything to the image. I have checked from shapesheet the name of the image.
Thank you in advance for any help and guidance on this.
Private Sub ToggleButton1_Click()
Dim shp As Visio.Shape
If Me.ToggleButton1.Value = True Then
Set shp = Application.ActiveDocument.Pages("Page-1").Shapes("Sheet.1")
shp.CellsSRC(visSectionObject, visRowImage, visImageTransparency).FormulaForceU = "100"
ElseIf Me.ToggleButton1.Value = False Then
Set shp = Application.ActiveDocument.Pages("Page-1").Shapes("Sheet.1")
shp.CellsSRC(visSectionObject, visRowImage, visImageTransparency).FormulaForceU = "0"
End If
End Sub
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
针对上面的问题,我找到了一种让图像不可见的方法。操作形状表不起作用,因此作为解决方法,我只是为图像添加了一个图层,并让切换框控制图层的可见性。下面是我使用的代码。
In relation to the above question, I found a way to make the image invisible. Manipulating the shapesheet did not work so as a work around I just added a layer for the image and have the toggle box control the layer visibility instead. Below is the code I used.
feddyo013,你好!
您必须在公式中添加百分号 (%)。
feddyo013, hi there !
You must add percent sign (%) in your formulas.