zoukankan      html  css  js  c++  java
  • Delphi 颜色转换

    http://files.cnblogs.com/xe2011/StringToColor.rar

    unit Unit1;
    
    interface
    
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, StdCtrls;
    
    type
      TForm1 = class(TForm)
        Button1: TButton;
        Button2: TButton;
        procedure Button1Click(Sender: TObject);
        procedure Button2Click(Sender: TObject);
        procedure FormCreate(Sender: TObject);
        procedure FormClose(Sender: TObject; var Action: TCloseAction);
      private
        { Private declarations }
      public
        { Public declarations }
      end;
    
    var
      Form1: TForm1;
    
    implementation
    
    {$R *.dfm}
    
    uses IniFiles;
    
    procedure TForm1.Button1Click(Sender: TObject);
    begin
      Caption := ExtractFilePath(Application.ExeName);
    end;
    
    procedure TForm1.Button2Click(Sender: TObject);
    begin
      Color := StringToColor('clRed');
    end;
    
     
    
    procedure SaveConfig(fileName: string; Form: TForm);
    var
      f:string;
    begin
      f:=ExtractFilePath(Application.ExeName) + fileName;
      with TIniFile.Create( f ) do
      begin
        WriteString('MainForm', 'Color', ColorToString(Form.Color));
      end;
    end;
    
    procedure LoadConfig(fileName: string; Form: TForm);
    var
      s:string;
      f:string;
    begin
      f:=ExtractFilePath(Application.ExeName) + fileName;
      with TIniFile.Create(f) do
      begin
        s:= ReadString('MainForm', 'Color', 'clBtnFace');
        Form.Color := StringToColor(s);
      end;
    end;
    
    
    procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
    begin
         SaveConfig('Config.ini',Form1);
    end;
    
    procedure TForm1.FormCreate(Sender: TObject);
    begin
        LoadConfig('Config.ini',Form1);
    end;
    
     
    
    end.
  • 相关阅读:
    CSS3 @font-face
    CSS3 Media Queries
    简单弹出层示例
    mysql查询排名
    ajax 简单学习
    js ajax 传送xml dom对象到服务器
    雨燕权限管理后端技术总结
    日期date出参入参和timestamp转化
    雨燕权限管理前端技术总结
    jwt再度理解
  • 原文地址:https://www.cnblogs.com/xe2011/p/3426237.html
Copyright © 2011-2022 走看看