我想我可能没把问题说清楚。是这样的:
实际上,我的这个ICON文件是用ExtractIcon从.EXE文件中抓出来
的,现在的问题是,我想在SpeedButton中把这个ICON显示出来。
现在的制作进度如下:
var
AButton: TSpeedButton;
AIcon: TIcon;
begin
// Create a new SpeedButton and add it on the PalClient.
with AButton do
begin
// Create a SpeedButton
AButton := TSpeedButton.Create( Self );
// Add this button on the PalClient
Parent := PalClient;
Flat := True;
OnClick := Launch; // procedure Launch;
Tag := PalClient.ControlCount;
Top := 33 * (PalClient.ControlCount - 1);
Left := 2;
Height := 30;
Width := 127;
// Set the property of the button
Caption := 'Click here to launch an application';
// Extract Icon from an .EXE file and draw it on the button
AIcon := TIcon.Create;
AIcon.Handle := ExtractIcon( Application.Handle,
PChar( 'notepad.exe' ),
0
);
AButton.Glyph.Canvas.Draw( 0, 0, Icon );
AIcon.Free;
end; // end of with...
end;
不知道有没有不妥,反正拿出来让大家看看就知道我的用意了。