Einzelnen Beitrag anzeigen

Benutzerbild von Sanchez
Sanchez

Registriert seit: 24. Apr 2003
Ort: Neumarkt Stmk
892 Beiträge
 
Delphi XE6 Enterprise
 
#4

Re: colorpickers farben in hex umwandeln

  Alt 22. Dez 2003, 19:18
hallo,

Du willst doch nichts anderes als die Farbe aus dem Colorpicker an eine bestimmte Stelle im SynMemo einfügen.

Den Hexwert der Farbe als String bekommst du mit dieser Funktion (hab ich hier auch in nem anderen Thread schon mal geschrieben):

Delphi-Quellcode:
function Sto_ColorToHtml(const Color: TColor): String;
var
  iRgb: Longint;
  iHtml: Longint;
begin
  // convert system colors to rgb colors
  iRgb := ColorToRGB(Color);
  // change BBGGRR to RRGGBB
  iHtml := ((iRgb and $0000FF) shl 16) or // shift red to the left
           ( iRgb and $00FF00) or // green keeps the place
           ((iRgb and $FF0000) shr 16); // shift blue to the right
  // create the html string
  Result := '#' + IntToHex(iHtml, 6);
end;
Du liest die Farbe aus dem Colorpicker aus, schickst sie in diese Funktion und hast den richtigen HTML-Farb-String. Jetzt musst du den String noch ins SynEdit schreiben.

Welcher Punkt ist dir also unklar?

grüße, daniel
Daniel
Testen ist feige!
  Mit Zitat antworten Zitat