| Autor |
Beitrag |
Tweafis
      
Beiträge: 647
WinXP + fbsd
Delphi 5 Prof
|
Verfasst: So 29.06.03 18:43
Ich arbeite ja gerade an meinem Panel und irgendwie kann man von den ganzen "System"Farben keine RGBWerte abfragen... Ich denke mal das liegt daran, dass die irgendwie mit den Palleten Arbeiten. Auf jedenfall gibt z.B.
Delphi-Quelltext 1: 2: 3: 4: 5:
| var a: Integer;
a := clBtnFace; GetRValue(a); |
Man kann aber z.B. nicht GetRValue(clBtnFace) machen... (konstantenausdruck verletzt untere grenzen)
clBtnFace hat die Werte
r: 236
g: 233
b: 216
und nix 15...
_________________ .: Es wird der Tag kommen, an dem wir es nicht mehr ändern können :.
|
|
Gast
Gast
Erhaltene Danke: 1
|
Verfasst: So 29.06.03 18:59
btnFaceCol:=GetSystemColor(clBtnFace and (not $80000000));
Siehe Farbdeklarationen in der Graphics.pas!
Du kannst Standardwerte nicht einfach zu RGBs machen. Das ist übrigens eher Windows API :)
Hier ein Codeschnipsel in dem ich die Farbwerte der VCL konvertiere:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33: 34: 35: 36: 37: 38: 39: 40: 41: 42: 43: 44: 45: 46: 47: 48: 49: 50: 51: 52: 53: 54: 55: 56: 57: 58: 59: 60: 61: 62: 63: 64: 65: 66: 67: 68: 69: 70: 71:
| case FillColor of
clScrollBar,
clBackground,
clActiveCaption,
clInactiveCaption,
clMenu,
clWindow,
clWindowFrame,
clMenuText,
clWindowText,
clCaptionText,
clActiveBorder,
clInactiveBorder,
clAppWorkSpace,
clHighlight,
clHighlightText,
clBtnFace,
clBtnShadow,
clGrayText,
clBtnText,
clInactiveCaptionText,
clBtnHighlight,
cl3DDkShadow,
cl3DLight,
clInfoText,
clInfoBk:
FillColor := GetSysColor(FillColor and (not $80000000));
clNone, clDefault: begin
SetLastError(ERROR_INVALID_PARAMETER);
exit;
end;
end; |
Moderiert von Tino: Code- durch Delphi-Tags ersetzt.
|
|
Tweafis 
      
Beiträge: 647
WinXP + fbsd
Delphi 5 Prof
|
Verfasst: So 29.06.03 20:41
Lots'a thx
hab jetzt deins in ne function umgeformt, falls es jmd. interessiert:
1: 2: 3: 4: 5: 6: 7: 8: 9: 10: 11: 12: 13: 14: 15: 16: 17: 18: 19: 20: 21: 22: 23: 24: 25: 26: 27: 28: 29: 30: 31: 32: 33:
| function GetColorIfSys(const Color: TColor): TColor; begin case Color of clScrollBar, clBackground, clActiveCaption, clInactiveCaption, clMenu, clWindow, clWindowFrame, clMenuText, clWindowText, clCaptionText, clActiveBorder, clInactiveBorder, clAppWorkSpace, clHighlight, clHighlightText, clBtnFace, clBtnShadow, clGrayText, clBtnText, clInactiveCaptionText, clBtnHighlight, cl3DDkShadow, cl3DLight, clInfoText, clInfoBk: result := GetSysColor(Color and (not $80000000)); else result := Color; end; end; |
_________________ .: Es wird der Tag kommen, an dem wir es nicht mehr ändern können :.
|
|
blackdrake
Hält's aus hier
Beiträge: 8
Windows XP Professional
D7 Enterprise
|
Verfasst: Mi 06.07.05 12:49
Bei mir funktioniert das nicht...
Delphi-Quelltext 1: 2: 3: 4: 5: 6: 7: 8: 9: 10:
| uses graphics, dialogs;
procedure ... var a: TColor; begin a := GetSysColor(clBtnFace and (not $80000000)); showmessage(inttostr(getrvalue(a))); end; |
|
|
Keldorn
      
Beiträge: 2266
Erhaltene Danke: 4
Vista
D6 Prof, D 2005 Pro, D2007 Pro, DelphiXE2 Pro
|
Verfasst: Mi 06.07.05 17:50
es gibt noch colortorgb
Delphi-Quelltext 1: 2: 3: 4: 5: 6: 7: 8: 9:
| procedure TForm1.Button4Click(Sender: TObject); Var Color:Tcolor; begin color:=ColorToRGB(clBtnFace); ShowMessage('r:'+inttostr(GetRValue(color))+', g:'+inttostr(GetGValue(color))+', b:'+inttostr(GetBValue(color)));
color := GetSysColor(clBtnFace and (not $80000000)); ShowMessage('r:'+inttostr(GetRValue(color))+', g:'+inttostr(GetGValue(color))+', b:'+inttostr(GetBValue(color))); end; |
wobei bei mir die 2. Variante auch klappt.
Mfg Frank
_________________ Lükes Grundlage der Programmierung: Es wird nicht funktionieren.
(Murphy)
|
|
|