Entwickler-Ecke

Multimedia / Grafik - Problem mit Array of TImage


wieczo - Sa 19.10.02 04:54
Titel: Problem mit Array of TImage
Ich möchte ein Spielfeld zu Testzwecken erstellen. Den Code habe ich, bloß mein Problem ist, dass die Images nicht angezeigt werden, also nicht auf dem Formular sichtbar sind.
Der Code:

Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
const
  anzahl = 6;
  breite = 30;

type
  TPicArray = array[0..anzahl-1, 0..anzahl-1] of TImage;

var
  Form1: TForm1;
  Spielfeld : TPicArray;

implementation

{$R *.dfm}

procedure TForm1.SpielfeldInit(sp : TPicArray; form : TForm);
var i, j : integer;
begin
  for i := 0 to anzahl-1 do
    for j := 0 to anzahl-1 do
      begin
        sp[i, j] := TImage.create(form);
        with sp[i, j] do
          begin
            width := breite;
            height := breite;
            left := j*breite;
            top := i*breite;
            if i mod 2 = 0 then
              picture.Bitmap.LoadFromFile('E:\Chaos Clone\Pics\schwarz.bmp')
            else
              picture.Bitmap.LoadFromFile('E:\Chaos Clone\Pics\weis.bmp')

          end
      end
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  SpielfeldInit(Spielfeld, Form1)
end;


Etwas lang, sorry.
Vielen Dank im Voraus Thomas


wieczo - Sa 19.10.02 05:03

Problem gelöst :D ! Hab leider vergessen zu suchen.
Sorry Thomas


wieczo - Sa 19.10.02 05:15

Ich möchte dem OnClick-Ereignis eine Prozedur zu ordnen, z.B. ich klicke drauf und in Label1.Caption stehen 'i' und 'j'.

Danke schön im Voraus Thomas


DeCodeGuru - Sa 19.10.02 11:09

Wie man einem Button etc. eine Procedure für das OnClick-Ereignis zuordnet wurde schon mehrere Male besprochen. Ich würde einfach mal die Suchfunktion bemühen.