VB按钮改变图形颜色

来源:百度知道 编辑:UC知道 时间:2024/09/18 05:17:26
Private Sub Command1_Click()
If Command1.Caption = "开启" Then
Command1.Caption = "关闭"
With Shape1
.FillColor = &HFF00&
.FillStyle = 0
End With
ElseIf Command1.Caption = "关闭" Then
Command1.Caption = "开启"
With Shape1
.FillColor = &HFF&
.FillStyle = 0
End With
End If
End Sub
这个程序单独能行,放工程里怎么就不行了???

肯定是你工程的按钮属性和这个对不上,重新建个工程试试

必须有初值:Command1.Caption = "开启" 或Command1.Caption = "关闭" 。
只要没有变量、对象等冲突,应该没问题。