Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   GUI-Design mit VCL / FireMonkey / Common Controls (https://www.delphipraxis.net/18-gui-design-mit-vcl-firemonkey-common-controls/)
-   -   Delphi Stringgrid image einfügen (https://www.delphipraxis.net/64729-stringgrid-image-einfuegen.html)

Ayumi 7. Mär 2006 14:01


Stringgrid image einfügen
 
Hallo an Alle,

ich füge folgendermaßen ein Bild in die erste Spalte meines StringGrids ein:

Delphi-Quellcode:
procedure TForm1.Stringgrid1DrawCell( Sender : TObject;
                                                ACol,
                                                ARow   : Integer;
                                                Rect   : TRect;
                                                State  : TGridDrawState);

begin
 if (ARow > 0) and (ACol = 0) then SetCellPicture(Rect,Image1.Picture.Bitmap,Stringgrid1);
end;


procedure TForm1.SetCellPicture(Rect: TRect; Picture: TGraphic; Grid : TStringGrid);

begin
  grid.Canvas.Draw(Rect.Left,Rect.Top,Picture);
end;
Ich möchte aber dass das Bild genauso groß ist wie meine Stringgrid-zelle.
Wie kann ich das machen?

Ich bin wirklich sehr dankbar für jede Hilfe.

Niko 7. Mär 2006 17:12

Re: Stringgrid image einfügen
 
Hi,

dafür gibt's die Methode StretchDraw:
Delphi-Quellcode:
procedure TForm1.SetCellPicture(Rect: TRect; Picture: TGraphic; Grid : TStringGrid);
begin
  Grid.Canvas.StretchDraw(Rect, Picture);
end;

Ayumi 8. Mär 2006 10:42

Re: Stringgrid image einfügen
 
Dankeschön, so funktioniert es. :P


Alle Zeitangaben in WEZ +1. Es ist jetzt 00:32 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz