Private Sub Command3_Click()
Dim NewColor As Long
NewColor = ShowColor
If NewColor <> -1 Then
Me.BackColor = NewColor
Else
MsgBox "You chose cancel"
End If
End SubPrivate Function ShowColor() As Long
Dim cc As CHOOSECOLOR
Dim Custcolor(16) As Long
Dim lReturn As Long 'set the structure size
cc.lStructSize = Len(cc)
'Set the owner
cc.hwndOwner = Me.hwnd
'set the application's instance
cc.hInstance = App.hInstance
'set the custom colors (converted to Unicode)
cc.lpCustColors = StrConv(CustomColors, vbUnicode)
'no extra flags
cc.flags = 0 'Show the 'Select Color'-dialog
If CHOOSECOLOR(cc) <> 0 Then
ShowColor = cc.rgbResult
CustomColors = StrConv(cc.lpCustColors, vbFromUnicode)
Else
ShowColor = -1
End If
End Function
关于取得颜色值,查到再告诉你:-)
Dim NewColor As Long
NewColor = ShowColor
If NewColor <> -1 Then
Me.BackColor = NewColor
Else
MsgBox "You chose cancel"
End If
End SubPrivate Function ShowColor() As Long
Dim cc As CHOOSECOLOR
Dim Custcolor(16) As Long
Dim lReturn As Long 'set the structure size
cc.lStructSize = Len(cc)
'Set the owner
cc.hwndOwner = Me.hwnd
'set the application's instance
cc.hInstance = App.hInstance
'set the custom colors (converted to Unicode)
cc.lpCustColors = StrConv(CustomColors, vbUnicode)
'no extra flags
cc.flags = 0 'Show the 'Select Color'-dialog
If CHOOSECOLOR(cc) <> 0 Then
ShowColor = cc.rgbResult
CustomColors = StrConv(cc.lpCustColors, vbFromUnicode)
Else
ShowColor = -1
End If
End Function
关于取得颜色值,查到再告诉你:-)
解决方案 »
- 求:sql更新语句,问题解决100分马上送!!!
- 求教问题对象关闭时,不允许操作
- 随机密码生成问题
- 如何实现编辑框中的文本带有颜色,该用哪种控件(在线等,解决即封帖!)
- vb能条件编译吗?
- 在VB中如何得知Excel中的checkBox的選取與否?
- 怎样将产生的文件写在指定的目录下?
- vb中的坐标参考线代码怎么写 鼠标点击能够移动参考线
- 送份喽!!有用vba在CorelDraw9丽作开发的吗?继续加分中,
- xml采用异步方式send,如何处理没有响应的问题??
- VB安装包在安装时为何有时会出现“系统文件过期”的错误???
- ◆◆◆用过Installshield 5.5 的高手请进!高分求救:用Installshield5.5做的打包程序,安装后在控制面板里面添加安装程序中将其删除后只
MyColor = CommonDialog1.Color
ENDIF
On Error GoTo lEnd
Dim lngColor As Long
With CommonDialog1
.CancelError = True
.ShowColor
Text1.BackColor = .Color
End With
lEnd:
End Sub
Private Declare Function CHOOSECOLOR Lib "comdlg32.dll" Alias "ChooseColorA" (pChoosecolor As CHOOSECOLOR) As Long