Autor Beitrag
Baphomet
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20


Delphi 7
BeitragVerfasst: So 14.01.07 14:37 
Hallo

ich würde gerne im Laufe einer Prozedur eine Graphic in ein DrawGrid zeichnen. Nur hab ich irgendwie gar keine Ahnung wie ich das machen soll.

kann mir dabei vielleicht einer helfen?

vielen Dank

greetz Baph

ps: die Graphic liegt im Ordner des Programms
Baphomet Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20


Delphi 7
BeitragVerfasst: Mo 15.01.07 17:26 
hat niemand eine Ahnung
oder geht das etwa nicht :-(

???

greetz Baph
aim65
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 312

Win 9x, Win XP
Delphi 3pro, 7PE
BeitragVerfasst: Mo 15.01.07 17:52 
Da das DrawGrid eine Canvas-Eigenschaft besitzt, kannst Du drin herummalen. Beispiel für eine Linie:
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
//..
with DrawGrid1.Canvas do
begin
  Pen.Color := clBlue;
  MoveTo(10,10);   
  LineTo(100,100);  //malt ne blaue Linie
end;
//..
Baphomet Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 20


Delphi 7
BeitragVerfasst: Mo 15.01.07 20:15 
ja, das ist mir soweit schon klar

trotzdem danke

ich wollte aber wissen ob ich auch eine Graphik / Image / Bild in ein DrawGrid laden kann.
Und dass wollte ich während einer Prozedur machen...

greetz Baph
aim65
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 312

Win 9x, Win XP
Delphi 3pro, 7PE
BeitragVerfasst: Di 16.01.07 12:27 
Hab selber noch nie so etwas gemacht. Hier mal das Beispiel aus der Delphi-Hilfe für "OnDrawCell":
Zitat:
Im folgenden Beispiel wird der Inhalt der einzelnen Gitterzellen in einem Zeichengitter mit den Bitmaps aus einer Bilderliste gezeichnet. Die Zelle mit dem Fokus erhält ein Fokussierungsrechteck.
ausblenden Delphi-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
procedure TForm1.DrawGrid1DrawCell(Sender: TObject; Col, Row: Longint; Rect: TRect; State: TGridDrawState);

var
  index: integer;
begin
  index := Row * DrawGrid1.ColCount + Col;
  with Sender as TDrawGrid do
  begin
    Canvas.Brush.Color := clBackGround;
    Canvas.FillRect(Rect);
    ImageList1.Draw(Canvas,Rect.Left,Rect.Top,index);
    if gdFocused in State then
      Canvas.DrawFocusRect(Rect);
  end;
end;

Statt einer ImageList kann man ja auch ein einzelnes Bild nehmen. Weiß nicht, ob das weiterhilft. Probier mal die Suche mit DrawGrid/DrawCell.