![]() |
RGBToHex und umgekehrt
Ich konvertiere RGB zu Hex.
Delphi-Quellcode:
function TSkinEngine.RGBtoHEX(ColrRGB: ColorRef): string;
var R, G, B: Byte; begin R:= GetRValue(ColrRGB); G:= GetGValue(ColrRGB); B:= GetBValue(ColrRGB); Result:= Format('$%.2x%.2x%.2x', [R, G, B]); end;
Delphi-Quellcode:
UseColor := RGBtoHEX(RGB(11,37,86)); // := $0B2556;
jetzt umgekehrt.
Delphi-Quellcode:
Die Werte von R, G, B sind aber jetzt komplett anders. Was mache ich falsch?
if UseColor > '' then
begin R := Byte(StrToInt('$' + Copy(UseColor, 3, 2))); G := Byte(StrToInt('$' + Copy(UseColor, 5, 2))); B := Byte(StrToInt('$' + Copy(UseColor, 7, 2))); end
Delphi-Quellcode:
gruss
R := 178;
G := 85; B := 6; |
AW: RGBToHex und umgekehrt
sorry für die Post habe mich da um eins vertan ;)
Delphi-Quellcode:
So stimmt es.
R := Byte(StrToInt('$' + Copy(UseColor, 2, 2)));
G := Byte(StrToInt('$' + Copy(UseColor, 4, 2))); B := Byte(StrToInt('$' + Copy(UseColor, 6, 2))); gruss |
AW: RGBToHex und umgekehrt
Zitat:
|
AW: RGBToHex und umgekehrt
Zitat:
Ich habe doch vor deinem Beitrag es schon selbst berichtigt. Zitat:
Nochmal.
Delphi-Quellcode:
gruss
R := Byte(StrToInt('$' + Copy(UseColor, 2, 2)));
G := Byte(StrToInt('$' + Copy(UseColor, 4, 2))); B := Byte(StrToInt('$' + Copy(UseColor, 6, 2))); |
AW: RGBToHex und umgekehrt
Zitat:
|
AW: RGBToHex und umgekehrt
Zitat:
Aber egal. Trotzdem Danke! Sorry für meine Unprofessionelle Antwort. Zitat:
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:23 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz