VB6 Farbe in RGB

willimc

Mitglied
Hallo,
ich müsste mal die Farbe die Visual Basic 6 mit der Methode Point bekommt in eine RGB Farbe umwandeln. Wenn man einer Picturebox den RGB wert "RGB (0,255,0)" zuweist und dann mit picture1.point() die farbe wieder abgreift kommt da 65280 heraus. wie kann ich diese zahl wieder in (0,255,0) umwandeln?

danke für eure antworten
Gruß Timo
 
Hallo, versuch´s mal hiermit.
Code:
Private Type tRGB
  rot As Byte
  grün As Byte
  blau As Byte
End Type

Private Sub Command1_Click()
Dim MyRGB As tRGB

  MyRGB = GetRGB(65280)

  MsgBox MyRGB.rot
  MsgBox MyRGB.grün
  MsgBox MyRGB.blau
  
End Sub

Private Function GetRGB(Farbe As Long) As tRGB
  GetRGB.rot = (Farbe And &HFF&)
  GetRGB.grün = (Farbe And &HFF00&) \ 256
  GetRGB.blau = (Farbe And &HFF0000) \ 65536
End Function
 
Danke

Jo Dank dir. Das habe ich jetrt auch noch gefunden nachdem ich noch etwas weiter gesucht hatte... trotzdem gut wenn es hier steht für andere zum Nachlesen.
machs gut
 
Zurück