Wednesday, April 29, 2009

Translate Background Color

'Translate Background Color



Private Declare Function TranslateColor
Lib "olepro32.dll"
Alias _

"OleTranslateColor" (ByVal clr
As OLE_COLOR, ByVal palet
As Long, _

col As Long) As Long



Private Sub Form_Load()

Dim RealColor As Long

'You can change me.backcolor

Me.BackColor = vbGreen

'Convert OLE colors to RGB colors

TranslateColor Me.BackColor, 0, RealColor

'show the result

MsgBox "The backcolor of this form is R=" + _

CStr(RealColor And &HFF&) + " G=" + _

CStr((RealColor And &HFF00&) / 2 ^ 8) + " B=" + _

CStr((RealColor And &HFF0000) / 2 ^ 16), vbOKOnly, "RockessAlpha"

End Sub



 

No comments:

Post a Comment