get / set
system colors?
Author:
Simon Grossenbacher
Homepage:
http://www.swissdelphicenter.ch
0 Comments
to this tip [Write new comment]
[ Print tip
]
Tip Rating
(5):
Skill:
Useful:
Overall:
var
OldColor: TColor;
Element: TColor = COLOR_BTNFACE;
{....}
{
Set the color for a system element. SetSysColors
function
changes the current Windows session only.
The new colors are not saved when Windows
terminates.
For a list of color elements see Win32 API Help - Function GetSysColor
Setzt die Farbe für ein System Element.
SetSysColors wechselt die Farbe nur für die
laufende Windows Sitzung.
Die neuen Farben werden bei Neustart nicht
gespeichert.
Für eine Liste von Elementen siehe Win32 API
Hilfe - Funktion GetSysColor
Open the ColorDialog - and set the new color systemwide
Öffnet den ColorDialog und setzt die neue Farbe systemweit
}
procedure
TForm1.Button1Click(Sender: TObject);
begin
if ColorDialog1.Execute then
begin
SetSysColors(1, Element,
ColorDialog1.Color);
end;
end;
{
Save the old color value of the element
COLOR_BTNFACE to restore on Button2 click
Speichert den alten Farbwert vom Element COLOR_BTNFACE zum wiederherstellen
wenn auf Button2 gedrückt wird.
}
procedure
TForm1.FormShow(Sender: TObject);
begin
OldColor := GetSysColor(COLOR_BTNFACE);
end;
{
Restore the old color value
Stellt den alten Farbwert wieder her
}
procedure
TForm1.Button2Click(Sender: TObject);
begin
SetSysColors(1, Element, OldColor);
end;