unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Gauges, Grids;
type
TForm1 =
class(TForm)
StringGrid1: TStringGrid;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
private
{ Private-Deklarationen }
public
{ Public-Deklarationen }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var mGauge: TGauge;
begin
mGauge := TGauge.Create(Stringgrid1);
mGauge.Parent := stringgrid1;
mGauge.Progress := 48;
stringgrid1.Objects[2,2] := mGauge;
end;
procedure TForm1.StringGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
Rect: TRect; State: TGridDrawState);
var tmpGauge : TGauge;
begin
if (Acol = 2)
AND (Arow = 2)
then
begin
if stringgrid1.Objects[2,2] <>
nil then
begin
tmpGauge := (stringgrid1.Objects[2,2]
as TGauge);
with tmpGauge
do
begin
Left := Rect.Left;
Top := Rect.Top;
Width := Rect.Right - Rect.Left;
Height := Rect.Bottom - Rect.Top;
end;
end;
end;
end;
end.