unit Unit6;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Gauges, Grids;
type
TForm6 =
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
Form6: TForm6;
implementation
{$R *.dfm}
procedure TForm6.Button1Click(Sender: TObject);
var mGauge: TGauge;
begin
mGauge := TGauge.Create(Stringgrid1);
mGauge.Parent := stringgrid1;
mGauge.Progress := 48;
stringgrid1.Objects[2,2] := mGauge;
end;
procedure TForm6.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.