Autor Beitrag
blackbirdXXX

ontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1077
Erhaltene Danke: 1

Ubuntu Dapper

BeitragVerfasst: Do 12.06.03 21:22 
Ich möchte einen Colordialog(colord) Hexwerte wie in HTML ausspucken lassen.
Ich habe das so probiert:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
var ins: Integer;
    color: String;
begin
 if colord.Execute then
  begin
   ins := ColorToRGB(colord.Color);
   color := IntToHex(ins, 6);
   Richedit1.seltext := '#' + color;
  end;
end;


Leider kommen da falsche Fraben heraus.

_________________
Klein, schwarz und ärgert Techniker? Jumper!
blackbirdXXX Threadstarter

ontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1077
Erhaltene Danke: 1

Ubuntu Dapper

BeitragVerfasst: Sa 14.06.03 09:18 
Hat da echt keiner eine Ahnung?
Ich würde mich auch über eine Fremdkomponente freuen.

_________________
Klein, schwarz und ärgert Techniker? Jumper!
StefanH
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: Sa 14.06.03 11:09 
Hallo blackbirdXXX!
Ich tip, du brauchst das für deinen HTLM-Editor, oder? :wink:
Also: Delphi hat irgendwie die blöde Eigenschaft, statt RGB - BGR-Farben zu benutzen. Also musst du deine Hex zerlegen:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
var ins: Integer;
    color, bgr, r, g, b: String;
begin
 if colord.Execute then
  begin
   ins := ColorToRGB(colord.Color);
   bgr := IntToHex(ins, 6);
   r:= bgr;
   g:= bgr;
   b:= bgr;
   Delete(r,1,4);//blau & gelb löschen
   Delete(b,3,4);//rot & gelb löschen
   Delete(g,1,2);//blau löschen
   Delete(g,3,2);//gelb löschen
   color:= r + g + b; // aus b, g & r RGB-Farbe machen...
   Richedit1.SelText := '#' + color;//...und einfügen
  end;


So, das wars!

Stefan

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)
blackbirdXXX Threadstarter

ontopic starontopic starhalf ontopic starofftopic starofftopic starofftopic starofftopic starofftopic star
Beiträge: 1077
Erhaltene Danke: 1

Ubuntu Dapper

BeitragVerfasst: So 15.06.03 12:22 
Danke :)

Stimmt. Ich brauche das für Liquid Edit.
Sorry. Bin relativer Anfänger in Delphi.

_________________
Klein, schwarz und ärgert Techniker? Jumper!
StefanH
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 1144

Win XP
D5 Standard, D7 Pers, D2005 Pers
BeitragVerfasst: So 15.06.03 15:20 
blackbirdXXX hat folgendes geschrieben:
Danke :)
Sorry. Bin relativer Anfänger in Delphi.

Bitte :)
Ich hätts auch net gewusst, wenn ich net eine HTML Farbe für Delphi haben wollte

Stefan

_________________
"Als es noch keine Computer gab, war das Programmieren noch relativ einfach."(Edsger W. Dijkstra)
"Ich bin nicht von Sinnen, sondern ich rede wahre und vernünftige Worte." (Paulus)