我发现,一般都是这样是实现的!
用一个edit,设置edit的color属性为颜色就行了,响应onclick!弹出
颜色选择对话框,delphi自带!
例:
unit Unit2;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, ExtCtrls, Buttons, StdCtrls;
type
TForm2 = class(TForm)
ColorDialog1: TColorDialog;
Edit1: TEdit;
procedure FormCreate(Sender: TObject);
procedure Edit1Click(Sender: TObject);
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
procedure TForm2.Edit1Click(Sender: TObject);
begin
if ColorDialog1.Execute() then
Edit1.Color:=ColorDialog1.Color;
end;
end.