Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Multimedia (https://www.delphipraxis.net/16-multimedia/)
-   -   Delphi Array of TPaintbox - Keine Auto-Vervollständigung (erledigt) (https://www.delphipraxis.net/135741-array-tpaintbox-keine-auto-vervollstaendigung-erledigt.html)

nottrott 16. Jun 2009 22:39


Array of TPaintbox - Keine Auto-Vervollständigung (erledigt)
 
Hallo,

ich habe ein dynamisches Array aus TPaintboxen und habe dabei das Problem, dass die Code-Vervollständigung nicht richtig funktioniert.
Hier mal ein kurzer Beispielcode:
Delphi-Quellcode:
var
seiten : array of tpaintbox;
begin
setlength(seiten, 1);
seiten[0] := tpaintbox.Create(self);
seiten[0].Parent := form1;
seiten[0].Refresh;
seiten[0].Canvas.MoveTo(0,0);
seiten[0].Canvas.LineTo(20,20);
end;
Nach "seiten[0]." kommt noch die Auto-Vervollständigung aber nach "seiten[0].canvas." nicht mehr.
Weiß jemand, woran das liegt und wie ich es vllt. beheben kann?

Danke
nottrott

omata 16. Jun 2009 22:42

Re: Array of TPaintbox - Keine Auto-Vervollständigung
 
Helfe dem Compiler doch ein bißchen...
Delphi-Quellcode:
var
  seiten : array of TPaintBox;
  Paintbox : TPaintBox
begin
  setlength(seiten, 1);
  Paintbox := TPaintbox.Create(self);
  Paintbox.Parent := form1;
  Paintbox.Refresh;
  Paintbox.Canvas.MoveTo(0, 0);
  Paintbox.Canvas.LineTo(20, 20);
  seiten[0] := Paintbox;
end;

quendolineDD 16. Jun 2009 22:43

Re: Array of TPaintbox - Keine Auto-Vervollständigung
 
Oder halt (Seiten[0] as TPaintBox).XXX

nottrott 16. Jun 2009 22:54

Re: Array of TPaintbox - Keine Auto-Vervollständigung
 
Ok, danke. Werde es dann so machen wie von omata beschrieben.

Kann mir vllt. noch jemand sagen, warum ich direkt im FormCreate noch nicht auf die Paintbox zeichnen kann?

Vielen Dank
nottrott

omata 16. Jun 2009 23:12

Re: Array of TPaintbox - Keine Auto-Vervollständigung
 
Der Zugriff funktioniert, du siehst nur das Ergebnis nicht, weil die Form danach erst gezeichnet wird. Zeichne im OnPaint-Ereignis der PaintBox, dann wird gezeichnet, wenn es nötig ist.

nottrott 16. Jun 2009 23:15

Re: Array of TPaintbox - Keine Auto-Vervollständigung
 
Ah OK, vielen Dank.

nottrott


Alle Zeitangaben in WEZ +1. Es ist jetzt 12:32 Uhr.

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