Autor Beitrag
Default112
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 76

Win XP
D6 Prof
BeitragVerfasst: Sa 10.07.04 16:16 
Aaaaalso: Hab da sowas in die OnDrawCell Prozedur geschrieben:

ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
Procedure TForm1.Bilder_reinpacken(Sender: TObject; ACol,
  ARow: Integer; Rect: TRect; State: TGridDrawState);
var bild: Tbitmap;
Begin
  bild := Tbitmap.create;
  with Sender as TDrawGrid do
  begin
    ImageList1.GetBitmap(ImageList1.Tag, bild);
    Canvas.StretchDraw(rect, bild);
    ImageList1.Tag := ImageList1.Tag + 1;
    if ImageList1.Count <= ImageList1.Tag then
      ImageList1.Tag := 0;
  end;
end;

procedure TForm1.DrawGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);
begin
  Bilder_reinpacken(sender,acol,arow,Rect,State);
end;


So, klappt super, alles wird reingemalt, klasse. Aber: klicke ich eine Zelle an, so wird da ein anderes Bild reingemalt. Also ich habe 6 Bilder in der ImageList und wenn ich 6 mal auf eine Zelle klicke, so habe ich alle 6 Symbole jeweils einmal in der Zelle gehabt, es wird also die Stringlist von vorne nach hinten durchlaufen.

Weiss jemand Rat?

Thx im Vorraus
Def
sourcehunter
ontopic starontopic starontopic starontopic starontopic starontopic starofftopic starofftopic star
Beiträge: 482

Win XP | Suse 10.1
Delphi 2005 Pers.
BeitragVerfasst: So 18.07.04 20:41 
Wenn du eine Zell anklickst, dann wird nur DISES Zelle neugemalt. Als wenn du da schreibst tag:=tag+1, dann wird dein Bildindex jedesmal um eins erhöt.

_________________
Linux und OpenSource rulez!
BenBE
ontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic starofftopic star
Beiträge: 8721
Erhaltene Danke: 191

Win95, Win98SE, Win2K, WinXP
D1S, D3S, D4S, D5E, D6E, D7E, D9PE, D10E, D12P, DXEP, L0.9\FPC2.0
BeitragVerfasst: Mo 19.07.04 18:02 
Wenn du den Bildindex abhängig von der Zeile haben willst, empfiehlt sich die Verwendung von ARow. ACol gibt die zu zeichnende Spalte an.

_________________
Anyone who is capable of being elected president should on no account be allowed to do the job.
Ich code EdgeMonkey - In dubio pro Setting.