Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi Abgeleitete Klasse von Tshape wird nicht angezeigt (https://www.delphipraxis.net/67532-abgeleitete-klasse-von-tshape-wird-nicht-angezeigt.html)

Alexander Roth 16. Apr 2006 08:41


Abgeleitete Klasse von Tshape wird nicht angezeigt
 
Hi,

als ich habe eine Klasse von Tshape abgeleitet:
Delphi-Quellcode:
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.
und rufe sie so auf
Delphi-Quellcode:
feld1:=TFeld.Create(form1,rect(10,10,100,100),2);
  feld1.Parent:=form1;
Wieso kann ich keien Kreis sehen? Was habe ich falsch gemacht?

Alexander Roth 16. Apr 2006 08:44

Re: Abgeleitete Klasse von Tshape wird nicht angezeigt
 
Ohhhhhhhhhhh...

:wall: :wall: :wall: :wall: :wall: :wall: :wall: :wall:

Dummer dummer Fehler:
Delphi-Quellcode:
width:=pos.Left-pos.Left;
Kann ja auch garnicht klappten. Habe jetzt durch
Delphi-Quellcode:
  width:=pos.Right-pos.Left;
ersetzt. Und es klappt.


Alle Zeitangaben in WEZ +1. Es ist jetzt 11:27 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