Autor Beitrag
Travis
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48



BeitragVerfasst: So 13.04.03 15:48 
Hallo zusammen,

ich benutze heute zum ersten Mal ein DrawGrid und es funktioniert eigentlich überhaupt nicht. Im Internet habe ich zwar jede Menge Beispiele gefunden, jedoch wollen die nicht so recht laufen.

Ich habe jetzt mal ein bisschen was ausprobiert, um eine Grafik aus einer ImageList auszulesen und in der Tabelle darzustellen:

ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
procedure TfrmMailCheck.FormShow(Sender: TObject);
var Bitmap: TBitMap;
begin
  Bitmap := TBitmap.Create;
  imImages.GetBitmap(0, Bitmap);
  dgMails.Canvas.Draw(1, 1, Bitmap);
  FreeAndNil(Bitmap);
end;

Ich kann beim besten Willen den Fehler nicht finden.

Und dann ist mir nochwas unklar. Wie kann ich einen ganz normalen Text darstellen? Hatte es wie in einem StringGrid mit

ausblenden Quelltext
1:
  DrawGrid.Cells[0,0] := 'Text';					

probiert, aber da meckerte der Compiler.

Schonmal im Voraus Danke,

Travis
Blackout
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 64



BeitragVerfasst: So 13.04.03 16:23 
Hi Travis,
ich glaub um im DrawGrid ziechnen zu können muss man den Code immer in der DrawCell Prozedure schreiben.

Probier mal das hier:
ausblenden Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
Procedure TForm1.DrawGrid1DrawCell(Sender: TObject; ACol, ARow: Integer;
  Rect: TRect; State: TGridDrawState);

Var 
  BMP1: TBitmap;
  
Begin

  BMP1:= TBitmap.Create; 
  ImageList1.GetBitmap(0, BMP1);  
  
  If (ACol= 1) And (ARow= 1) Then
    Begin
      DrawGrid1.Canvas.Draw(Rect.Left+2, Rect.Top+3, BMP1);
      DrawGrid1.Canvas.TextOut(Rect.Left+22, Rect.Top+5, 'BMP1');
    End;

  BMP1.Free;

End;


Ich hoffe das hilft dir ein wenig

_________________
MfG Blackout
Travis Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 48



BeitragVerfasst: So 13.04.03 16:40 
Hi Blackout,

danke für deine Hilfe! Funktioniert jetzt alles so wie es soll!

Travis