Thema: Delphi Bitmaps skalieren

Einzelnen Beitrag anzeigen

omsec

Registriert seit: 4. Mai 2006
Ort: Luzern
8 Beiträge
 
Delphi 2006 Architect
 
#4

Re: Bitmaps skalieren

  Alt 5. Mai 2006, 13:11
Nun ja, auf den Komfort einer TImage-Komponente muss ich verzichten, da ich mich im OnDrawCell-Handler eines DrawGrids befinde, dieser kennt ja nur den Canvas. Daher mein Hinweis auf die TBitmap-Instanz.

Mir ist allerdings nicht ganz klar, wie ich die BtretchBlt-Funktion in diesem Kontext anwenden muss.

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

var
  bmp: TBitMap;
  
begin
// ShowMEssage('Col: ' + IntToStr(ACol) + ' Row: ' + IntToStr(ARow));
 bmp := TBitmap.Create;
 try
   if (ACol = 0) and (ARow = 0) then
     begin
       bmp.LoadFromFile('c:\temp\charset\1.bmp');
       StretchBlt ??? // Device Context = Handle der Form ?
     end;
   if (ACol = 1) and (ARow = 0) then
     bmp.LoadFromFile('c:\temp\charset\2.bmp');
   if (ACol = 2) and (ARow = 0) then
     bmp.LoadFromFile('c:\temp\charset\3.bmp');
   if (ACol = 3) and (ARow = 0) then
     bmp.LoadFromFile('c:\temp\charset\4.bmp');
   if (ACol = 4) and (ARow = 0) then
     bmp.LoadFromFile('c:\temp\charset\5.bmp');
 finally
   bmp.Free;
 end;
end;
  Mit Zitat antworten Zitat