![]() |
Abgeleitete Klasse von Tshape wird nicht angezeigt
Hi,
als ich habe eine Klasse von Tshape abgeleitet:
Delphi-Quellcode:
und rufe sie so auf
unit UFeld;
interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs,ExtCtrls; type TValue=0..4; TFeld = class(Tshape) private { Private-Deklarationen } Mycolor:TColor; FStones:TValue; procedure writeStones(value:TValue); public { Public-Deklarationen } constructor Create(AOwner: TComponent; pos:Trect; number:TValue=0); property Stones: TValue read FStones write writeStones; end; implementation constructor TFeld.Create(AOwner: TComponent; pos:Trect; number:TValue=0); begin inherited create(aowner); stones:=number; top:=pos.Top; left:=pos.Left; width:=pos.Left-pos.Left; height:=pos.Bottom-pos.Top; shape:=stCircle; pen.Style:=psclear; end; procedure Tfeld.writeStones(value:TValue); begin FStones:=value; case value of 0: Mycolor :=clgray; 1: Mycolor :=cllime; 2: Mycolor :=clgreen; 3: Mycolor :=clnavy; 4: Mycolor :=clred; end; end; end.
Delphi-Quellcode:
Wieso kann ich keien Kreis sehen? Was habe ich falsch gemacht?
feld1:=TFeld.Create(form1,rect(10,10,100,100),2);
feld1.Parent:=form1; |
Re: Abgeleitete Klasse von Tshape wird nicht angezeigt
Ohhhhhhhhhhh...
:wall: :wall: :wall: :wall: :wall: :wall: :wall: :wall: Dummer dummer Fehler:
Delphi-Quellcode:
Kann ja auch garnicht klappten. Habe jetzt durch
width:=pos.Left-pos.Left;
Delphi-Quellcode:
ersetzt. Und es klappt.
width:=pos.Right-pos.Left;
|
Alle Zeitangaben in WEZ +1. Es ist jetzt 21:40 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-2025 by Thomas Breitkreuz