Thema: Delphi Gauge in Stringgrid

Einzelnen Beitrag anzeigen

jolomino

Registriert seit: 19. Jan 2005
34 Beiträge
 
#3

Re: Gauge in Stringgrid

  Alt 6. Feb 2005, 22:55
so erstmal danke und ich habs mal probiert, aber die gauge wird übers stringgrid gelagert, also links oben über 4 zellen und 1,5 spalten

Delphi-Quellcode:
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.
müsste doch so passen oder?

gruss jolomino
  Mit Zitat antworten Zitat