unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Buttons, ExtCtrls;
type
TForm1 = class(TForm)
Image1: TImage;
BitBtn1: TBitBtn;
procedure BitBtn1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.BitBtn1Click(Sender: TObject);
type
LogPal = record
lpal : TLogPalette;
dummy:Array[0..255] of TPaletteEntry;
end;
var
SysPal : LogPal;
tempCanvas: TCanvas;
notused: HWnd;
begin
tempCanvas := TCanvas.Create;
tempCanvas.Handle := GetDeviceContext(notUsed);
SysPal.lPal.palVersion:=$300;
SysPal.lPal.palNumEntries:=256;
GetSystemPaletteEntries(tempCanvas.Handle,0,256,SysPal.lpal.palPalEntry);
Image1.Canvas.Font.Color:=clRed;
Image1.Canvas.Font.Size:=30;
Image1.Picture.Graphic.Palette:=CreatePalette(Syspal.lpal);
Image1.Canvas.TextOut(10,10,'Leon.Su');
tempcanvas.free;
end;
end.
这只是一个小例子,不完美,可以做一点引导.