有一个Button控件,被鼠标点击时应该怎样才能一个颜色选择框,这样可以选择不同的颜色?

解决方案 »

  1.   

    加一个公共对话框在窗体上,代码是改变窗体的背景色:
    Private Sub Command1_Click()
        With CommonDialog1
            .ShowColor
            If .Color <> 0 Then
                Me.BackColor = .Color
            End If
        End With
    End Sub^_^
      

  2.   

    使用 公共对话框 CommonDialog控件就可以了,使用VB的菜单"工程"-->"部件"--->"Mircosoft Common Dialog Control 6.0"就可以加载该控件了,然后使用该控件的ShowColor方法就可以了。