interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, ExtCtrls, Buttons, PanelGroup, RzPanel, RzButton,RzComMon;
type
TForm1 = class(TForm)
Button1: TButton;
BitBtn1: TBitBtn;
Image1: TImage;
Bevel1: TBevel;
RzPanel1: TRzPanel;
procedure FormCreate(Sender: TObject);
private
{ Private declarations }
public
procedure PanelOnEnter(Sender: TObject);
procedure PanelOnClick(Sender: TObject);
end;
var
Form1: TForm1;
RzPanel : array[0..31,0..6] of TRzPanel;
implementation
{$R *.dfm}
//创建色板
procedure TForm1.FormCreate(Sender: TObject);
var
I,j : integer;
str,R,G,B: string;
begin
for i:=0 to 31 do
begin
for j:=0 to 6 do
begin
RzPanel[i][j]:= TRzPanel.Create(nil);
RzPanel[i][j].Parent :=Form1;
RzPanel[i][j].Top := j*(RzPanel[i][j].Top +30)+15;
RzPanel[i][j].Height := 23;
RzPanel[i][j].Width :=23;
RzPanel[i][j].Left := i* (RzPanel[i][j].Width+5) + 60;
RzPanel[i][j].ShowHint := true;
RzPanel[i][j].BorderOuter := fsNone;
RzPanel[i][j].BorderColor := clActiveBorder;
RzPanel[i][j].BorderWidth := 1;
RzPanel[i][j].OnMouseEnter := PanelOnEnter;
RzPanel[i][j].OnClick := PanelOnClick;
end;
RzPanel[i][0].Color := RGB(255,255,255-i*2);
str := ‘$‘;
R := format(‘%0x‘,[ord(255)]);
G := format(‘%0x‘,[ord(255)]);
B := format(‘%0x‘,[ord(255-i*2)]);
RzPanel[i][0].Hint := Str + R +G +B;
RzPanel[i][1].Color := RGB(255,255-i*2,255);
R := format(‘%0x‘,[ord(255)]);
G := format(‘%0x‘,[ord(255-i*2)]);
B := format(‘%0x‘,[ord(255)]);
RzPanel[i][1].Hint := Str + R +G +B;
RzPanel[i][2].Color := RGB(255,255-i*2,255-i*2);
R := format(‘%0x‘,[ord(255)]);
G := format(‘%0x‘,[ord(255-i*2)]);
B := format(‘%0x‘,[ord(255-i*2)]);
RzPanel[i][2].Hint := Str + R +G +B;
RzPanel[i][3].Color := RGB(255-i*2,255,255);
R := format(‘%0x‘,[ord(255-i*2)]);
G := format(‘%0x‘,[ord(255)]);
B := format(‘%0x‘,[ord(255)]);
RzPanel[i][3].Hint := Str + R +G +B;
RzPanel[i][4].Color := RGB(255-i*2,255,255-i*2);
R := format(‘%0x‘,[ord(255-i*2)]);
G := format(‘%0x‘,[ord(255)]);
B := format(‘%0x‘,[ord(255-i*2)]);
RzPanel[i][4].Hint := Str + R +G +B;
RzPanel[i][5].Color := RGB(255-i*2,255-i*2,255);
R := format(‘%0x‘,[ord(255-i*2)]);
G := format(‘%0x‘,[ord(255-i*2)]);
B := format(‘%0x‘,[ord(255)]);
RzPanel[i][5].Hint := Str + R +G +B;
RzPanel[i][6].Color := RGB(255-i*2,255-i*2,255-i*2);
R := format(‘%0x‘,[ord(255-i*2)]);
G := format(‘%0x‘,[ord(255-i*2)]);
B := format(‘%0x‘,[ord(255-i*2)]);
RzPanel[i][6].Hint := Str + R +G +B;
end;
end;
原文:http://www.cnblogs.com/lingzhiwen/p/3705001.html