Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi DrawGrid will nicht anzeigen... :/ (https://www.delphipraxis.net/16423-drawgrid-will-nicht-anzeigen.html)

NeoXan 16. Feb 2004 22:18


DrawGrid will nicht anzeigen... :/
 
Moin,

Delphi-Quellcode:
type
 TField = class(TDrawGrid)
  private

  public
   constructor Create();
   function ReY(Y:Integer; img:TDrawGrid): Integer;
   procedure Init;
   procedure Refresh(Sender: TObject);
end;

var
 Rondo   : array[1..4 ]    of TRondo;

constructor TField.Create();
begin
 inherited Create(nil);
 Self.Left            := CFieldLe;
 Self.Top             := CFieldRi;
 Self.Width           := CFieldWd;
 Self.Height          := CFieldHt;
 Self.ColCount        := CCols;
 Self.RowCount        := CRows;
 Self.DefaultColWidth := 60;
 Self.DefaultRowHeight := 60;
 Self.FixedCols       := 0;
 Self.FixedRows       := 0;
 Self.Ctl3D           := false;
 Self.Options         := [goFixedVertLine,goFixedHorzLine,
                           goVertLine,goHorzLine];
 Self.Parent          := frmMain;
 Self.Canvas.Pen.Color := $00333333;
 Self.Canvas.Pen.Width := 5;
 Self.OnClick := Self.Refresh;      
 Self.Init;
end;

procedure TField.Refresh(Sender: TObject);
var a: integer;
begin
 for a:=1 to High(Rondo) do Rondo[a].Show;
end;

procedure TField.Init;
var a:Integer;
begin
 for a:=1 to High(Rondo) do Rondo[a] := TRondo.Create;
 Rondo[1].Init(4,1,P1Col);
 Rondo[2].Init(5,1,P1Col);
 Rondo[3].Init(4,8,P2Col);
 Rondo[4].Init(5,8,P2Col);
end;
Delphi-Quellcode:
type
  TRondo = class
  private
    Fx, Fy, Fr: Integer;
    Fcol: TColor;
  public
  procedure Init(xx,yy: integer; colo:TColor);
  procedure Show;

  published
  property x  : Integer read Fx write Fx;
  property y  : Integer read Fy write Fy;
  property r  : Integer read Fr write Fr;
  property col : TColor read Fcol write Fcol;
end;

procedure TRondo.Init(xx,yy: integer; colo:TColor);
begin
 r    := CRondoR;
 col  := colo;
 y    := yy-1;
 x    := xx-1;
end;

procedure TRondo.Show;
var b         : Tcolor;
   oben, links : integer;
begin
 oben  := Field.CellRect(y,x).Top;
 links := Field.CellRect(y,x).Left;
 Field.Canvas.Brush.Color := col;
 Field.Canvas.Pen.Color  := CPCol;
 Field.Canvas.Pen.Width  := CPWd;
 Field.Canvas.Ellipse(oben+(CRondoR-(CRondoR-3)),links+(CRondoR-(CRondoR-3))
                     ,oben+(CRondoR-3),links+(CRondoR-3));
end;
Es funzt nur so Self.OnClick := Self.Refresh;
Wenn ich die Zeile in der Refresh Prozedure am ende der Init Prozedure von Field schreibe dann passiert nichts außer vielleicht mal eine Access Violation...

mfg
NeoXan


Alle Zeitangaben in WEZ +1. Es ist jetzt 22:10 Uhr.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz