unrealgun
Messages postés87Date d'inscriptionmardi 16 décembre 2003StatutMembreDernière intervention 4 mars 2008
-
18 mars 2005 à 22:04
unrealgun
Messages postés87Date d'inscriptionmardi 16 décembre 2003StatutMembreDernière intervention 4 mars 2008
-
19 mars 2005 à 12:59
Bonjour,
voilà le problème : j'aimerais savoir comment je pourrais avoir le niveau de couleur Red Green et Blue à partir d'une ole_color.
En clair, j'aimerais avoir le contraire de la fonction RGB(r,g,b)
Gobillot
Messages postés3140Date d'inscriptionvendredi 14 mai 2004StatutMembreDernière intervention11 mars 201934 18 mars 2005 à 22:31
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
'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)
Gobillot
Messages postés3140Date d'inscriptionvendredi 14 mai 2004StatutMembreDernière intervention11 mars 201934 18 mars 2005 à 23:36
'une autre méthode
Private Declare Function GetSysColor Lib "user32" (ByVal nIndex As Long) As Long
Private Declare Sub CopyMemory Lib "kernel32" Alias "RtlMoveMemory" (Destination As Any, Source As Any, ByVal Length As Long)
Private Sub Command2_Click()
Dim couleur As Long
Dim C(2) As Byte
Dim index As Byte
index = Me.BackColor And 255
couleur = GetSysColor(index)
CopyMemory C(0), couleur, 3
MsgBox "Rouge= " & C(0)
MsgBox "vert= " & C(1)
MsgBox "Bleu= " & C(2)
End Sub