用户自定义控件颜色:用ColorDialog自定义颜色,并从配置文件中读取和写入
2010-03-10 17:43
477 查看
用
ColorToString(ColorDialog.Color)
StringToColor('$800080')
实现自定义颜色
procedure TFormBreakSiteStat.SpeedButton1Click(Sender: TObject);
var
lIniPath: string;
ini: TIniFile;
begin
lIniPath:= ExtractFilePath(Application.ExeName)+'ProjectCFMS_Client.ini';
ini:= TIniFile.Create(lIniPath);
try
if ColorDialog.Execute then
begin
if RBCaption.Checked then
begin
ini.WriteString('Color','CaptionColor',ColorToString(ColorDialog.Color));
FG_RepShow.CaptionColor:= ColorDialog.Color;
end;
if RBLabel.Checked then
begin
ini.WriteString('Color','LabelColor',ColorToString(ColorDialog.Color));
FG_RepShow.LabelColor:= ColorDialog.Color;
end;
if RBData.Checked then
begin
ini.WriteString('Color','DataColor',ColorToString(ColorDialog.Color));
FG_RepShow.DataColor:= ColorDialog.Color;
end;
if RBBackground.Checked then
begin
ini.WriteString('Color','BackgroundColor',ColorToString(ColorDialog.Color));
FG_RepShow.Color:= ColorDialog.Color;
end;
end;
finally
ini.Free;
end;
end;
procedure TFormBreakSiteStat.GetRepColor;
var
lIniPath: string;
ini: TIniFile;
begin
lIniPath:= ExtractFilePath(Application.ExeName)+'ProjectCFMS_Client.ini';
if FileExists(lIniPath) then
begin
ini:= TIniFile.Create(lIniPath);
try
FG_RepShow.CaptionColor:= StringToColor(ini.ReadString('Color','CaptionColor','clPurple'));
FG_RepShow.LabelColor:= StringToColor(ini.ReadString('Color','LabelColor','clSkyBlue'));
FG_RepShow.DataColor:= StringToColor(ini.ReadString('Color','DataColor','clTeal'));
FG_RepShow.Color:= StringToColor(ini.ReadString('Color','BackgroundColor','clInactiveCaptionText'));
finally
ini.Free;
end;
end;
end;
ColorToString(ColorDialog.Color)
StringToColor('$800080')
实现自定义颜色
procedure TFormBreakSiteStat.SpeedButton1Click(Sender: TObject);
var
lIniPath: string;
ini: TIniFile;
begin
lIniPath:= ExtractFilePath(Application.ExeName)+'ProjectCFMS_Client.ini';
ini:= TIniFile.Create(lIniPath);
try
if ColorDialog.Execute then
begin
if RBCaption.Checked then
begin
ini.WriteString('Color','CaptionColor',ColorToString(ColorDialog.Color));
FG_RepShow.CaptionColor:= ColorDialog.Color;
end;
if RBLabel.Checked then
begin
ini.WriteString('Color','LabelColor',ColorToString(ColorDialog.Color));
FG_RepShow.LabelColor:= ColorDialog.Color;
end;
if RBData.Checked then
begin
ini.WriteString('Color','DataColor',ColorToString(ColorDialog.Color));
FG_RepShow.DataColor:= ColorDialog.Color;
end;
if RBBackground.Checked then
begin
ini.WriteString('Color','BackgroundColor',ColorToString(ColorDialog.Color));
FG_RepShow.Color:= ColorDialog.Color;
end;
end;
finally
ini.Free;
end;
end;
procedure TFormBreakSiteStat.GetRepColor;
var
lIniPath: string;
ini: TIniFile;
begin
lIniPath:= ExtractFilePath(Application.ExeName)+'ProjectCFMS_Client.ini';
if FileExists(lIniPath) then
begin
ini:= TIniFile.Create(lIniPath);
try
FG_RepShow.CaptionColor:= StringToColor(ini.ReadString('Color','CaptionColor','clPurple'));
FG_RepShow.LabelColor:= StringToColor(ini.ReadString('Color','LabelColor','clSkyBlue'));
FG_RepShow.DataColor:= StringToColor(ini.ReadString('Color','DataColor','clTeal'));
FG_RepShow.Color:= StringToColor(ini.ReadString('Color','BackgroundColor','clInactiveCaptionText'));
finally
ini.Free;
end;
end;
end;
相关文章推荐
- C#读取和写入配置文件
- Springboot 之 自定义配置文件及读取配置文件
- delphi读取和写入文件-richedit控件
- Spring-boot中读取核心配置文件application和自定义properties配置文件的方式
- linux用户登陆的读取配置文件过程
- Springboot 之 自定义配置文件及读取配置文件
- Qt:让控件(widgets)内容可以自动 保存/读取 到配置文件(QSettings)中
- 如何在SpringBoot下读取自定义properties配置文件
- 如何在SpringBoot下读取自定义properties配置文件
- 在准备 Windows 映像时自定义默认本地用户配置文件
- Python 读取写入配置文件 —— ConfigParser
- 在SpringBoot下读取自定义properties配置文件的方法
- Java配置文件Properties的读取、写入与更新操作
- Java配置文件Properties的读取、写入与更新操作
- C# config配置文件 自定义节点读取
- 【Java编程】写入、读取、遍历配置文件 Properties类
- WPF学习笔记--使用配置文件修改控件、面板颜色
- 无法读取用户配置文件,系统自动建立Temp临时用户
- java中经常用到的读写配置文件的信息properties属性的写入,读取例子
- Springboot-读取核心配置文件及自定义配置文件