TImage problem with scaling lazarus / 31-LCL ---------------------------------------------------------------------- Firebird · 2024-04-05 13:22 I have generated a form that is to show the status of certain fields by bitmaps (see attached screenshot). The TImage(s) are filled from an TImageList instance that holds images at 16x16 and 22x22 pixel resolutions. When I assign the images to the form only the 16x16 pixel resolution is depicted there. What am I doing wrong? The function doing the assignment looks like: procedure TForm25.ShowData(alabel: TLabel; show_label: integer; aimage: TImage; show_image: integer; image_no: integer); var   aRect : TRect; begin   if (show_label = 0) then   begin     alabel.Enabled := False;     aimage.Visible := False;   end   else if (show_label = 1) then   begin     alabel.Enabled := True;     ImageList1.GetBitmap(image_no, TCustomBitmap(aimage.Picture.Bitmap));     aRect := Rect(aimage.Left, aimage.Top, aimage.Left+aimage.Width, aimage.Top+aimage.Height);     aimage.Picture.Bitmap.Canvas.StretchDraw(aRect, aimage.Picture.Bitmap);     aimage.Visible := True;   end end; ---------------------------------------------------------------------- wp · 2024-04-05 15:41 Quote from: Firebird on April 05, 2024, 03:22:50 pmWhat am I doing wrong? No idea since I don't know what you are doing beyond that code excerpt. Please prepare a small project showing the issue, and upload it here (under "Attachment and other options", pack the pas, lfm, lpi, and lpr files into a common zip, no compilier-generated files). And what do you mean with "scaling"? Scaling the form and the images when the monitor resolution changes? What is your Lazarus version? If you work with v3.0 or newer then TImage has Images and ImageIndex properties; this way LCL scaling of images is much easier - see attached project and the screenshots take from it at 96ppi (100%) and 120ppi (125%) ---------------------------------------------------------------------- Firebird · 2024-04-06 10:42 Thank you for your feedback. Pls. find attached the sample project. I am using Lazarus 2.2.4 and would like to stick to that version. The retrieved bitmaps (right column) should have the same resolution (size) as the bitmaps on the left side. What I am doing wrong? ---------------------------------------------------------------------- wp · 2024-04-06 22:41 I still don't know whether you are concerned about LCLscaling of images (i.e. scaling of image size when the monitor resolution changes). If you are, I am missing that ImageList.Scaled has not been set to true - this would activate LCLScaling for the image list. If, on the other hand, you only want to extract a specific image size from the image list, you can use the Resolution[ImageSize] property of the ImageList: 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.Button1Click(Sender: TObject);begin  ImageList1.Resolution[22].GetBitmap(0, Image1.Picture.Bitmap);  ImageList1.Resolution[22].GetBitmap(1, Image2.Picture.Bitmap);end;The "[22]" refers to the requested image size. ---------------------------------------------------------------------- Firebird · 2024-04-07 11:32 Thank you very much for the explanation WP. That really helped me. I am fine now.