Thema: Delphi Zeigerproblem

Einzelnen Beitrag anzeigen

nEmai

Registriert seit: 9. Feb 2008
29 Beiträge
 
Delphi 2007 Professional
 
#1

Zeigerproblem

  Alt 4. Apr 2008, 20:25
Hiho,

Ich hab es (noch) nicht so mit Zeigern und daher keine Ahnung was Delphi nun wirklich von mir will.

Delphi-Quellcode:
  TBarGraph = class
    private
      PBitmap: ^TBitmap;
      FBars: Array of Integer;
      procedure Bar(const aPosition, aValue: Integer);
      procedure ArraySwap(const aPosition1, aPosition2: Integer);
      procedure BitmapSwap(const aPosition1, aPosition2: Integer);
    public
      constructor Create(var aImage: TImage; aForm: TForm);
      destructor Destroy; override;
      procedure Draw;
      procedure BubbleSort;
      procedure QuickSort(const aLow, aHigh: Integer);
  end;

var
  Form1: TForm1;
  bKill: Boolean;
  MyBarGraph: TBarGraph;

implementation
{$R *.dfm}

constructor TBarGraph.Create(var aImage: TImage; aForm: TForm);
const
  MAXRANDOM= 530;
  BARQUANTITY= 150;
var
  iCounter: Integer;
begin
  inherited Create;
  setLength(FBars, BARQUANTITY);
  for iCounter:= 0 to High(FBars) do
    FBars[iCounter]:= random(MAXRANDOM)+1;
  PBitmap:= @aImage.Picture.Bitmap; //<--------
  PBitmap^.Height:= MAXRANDOM+20;
  PBitmap^.Width:= (Length(FBars)*4)+8;
  aImage.Height:= PBitmap^.Height;
  aImage.Width:= PBitmap^.Width;
  aForm.Height:= PBitmap^.Height+130;
  aForm.Width:= PBitmap^.Width+100;
end;
Schmeißt bei Aufruf in der markierten Zeile den Fehler "Variable erforderlich".
Was ist daran falsch?

MfG.
  Mit Zitat antworten Zitat