load and stretch a bmp lazarus / 39-Graphics ---------------------------------------------------------------------- elcomportal · 2018-03-30 15:31 Hi, i want to simulate a LED matrix. the matrix have a size of 60 x x60 LEDs. So i want to load an image in a TBitmap, shrink it to 60 x 60 pixels and then i want to stretch it to an TImage with a size of 600 x 600 pixels. Then every pixel of the image will show as a square pad of 10 x 10 pixels. That work. Now i want to increment the pixels of the matrix by clicking on speedbutton13. But with every click the image grows (it's okay), but also the pixelsize grows also, but it have to be every time 10 x 10 pixels. Whats my mistake? Here is the code: Code: Pascal  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i procedure TForm1.SpeedButton13Click(Sender: TObject);var  F: TextFile;  S: string;   sr: tsearchrec;  datDatei: file of byte;  chrZeichen: byte;begin   led_anzahl_zeile:=led_anzahl_zeile + 1;   bildgroesse :=bildgroesse + raster;   videocanvas.width := led_anzahl_zeile * raster;   videocanvas.height := led_anzahl_zeile * raster;   label1.caption:=LeftPad(trackbar1.position);   if FindFirst('d://mdf/ projects/kosmetikstudio_zarriess/temp/'+LeftPad(trackbar1.position)+'. bmp',faAnyFile,sr) = 0 then   begin      if (SR.Attr and faDirectory) = 0 then      begin         bmp:=TBitmap.Create;         vpbmp:=TBitmap.Create;         videocanvas.Canvas.FillRect(0,0,videoc anvas.Width,videocanvas.height);         bmp.Width:=bildgroesse;       bmp.Height:=bildgroesse;         bmp.LoadFromFile('d://mdf/projects/temp/'+sr.name);         vpbmp.Width:=led_anzahl_zeile ;         vpbmp.Height:=led_anzahl_zeile;         vpbmp.Canvas.copyrect(rect(0, 0,led_anzahl_zeile,led_anzahl_zeile),bmp.canvas,rect(0,0,bildgroesse,b ildgroesse));         videocanvas.Canvas.StretchDraw(Rect(0,0,videocan vas.height,videocanvas.width),vpbmp);         label2.caption:=inttostr(bildgroesse)+' '+IntToStr(led_anzahl_zeile)+' '+inttostr(bmp.width)+' '+inttostr(vpbmp.width)+' '+inttostr(0) ;         videocanvas.Update;         Application.ProcessMessages;         bmp.Free;         vpbmp.Free;      end;      FindClose(SR);   end; end; ---------------------------------------------------------------------- circular · 2018-04-04 08:53 I would say you cannot resize bmp like that: Code: Delphi  [Select][+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i bmp.Width:=bildgroesse;         bmp.Height:=bildgroesse;because then you do LoadFromFile which sets the Width and Height from the file.