Mark Williams 15 Posted yesterday at 10:36 AM I have a custom component derived from TPanel. There are several other components included including a TToolBar. There was also a TImageList which loaded bitmaps from a resource file to provide the icons for the toolbar. I'm finally getting around to trying to update this to work with TVirtualImageList and transparent PNG files (24 x 24) rather than bitmaps. It works, but is not scaling properly. On higher resolution monitors the toolbuttons are far too small. I suspect my problem is with the scaling of the toolbar rather than the imagelist. But I'm not entirely sure that's correct or what to do about it. The relevant code is below. FImageList := TVirtualImageList.create(self); FImageList.SetSize(TargetSize, TargetSize); FImageList.ImageCollection := FImageCollection; FImageList.DisabledGrayscale := true; FImageList.Height := 24; FImageList.Width := 24; FToolBar := TToolbar.create(self); FToolBar.parent := self; with FToolBar do begin Height := 36; ButtonWidth := 35; ButtonHeight := 35; align := alTop; ShowHint := true; AutoSize := true; Wrapable := true; end; Share this post Link to post
Remy Lebeau 1602 Posted yesterday at 03:42 PM (edited) The higher the resolution is, the smaller a 24x24 image is going to look. You need multiple images of different sizes, and then choose the appropriate size for a given resolution. Are you doing that? The whole point of TImageCollection is to provide images of different sizes/resolutions, and then TVirtualImageList presents those images at a given size/resolution. Where are you making adjustments based on the current resolution? Edited yesterday at 03:43 PM by Remy Lebeau Share this post Link to post
Uwe Raabe 2157 Posted yesterday at 05:59 PM 2 hours ago, Remy Lebeau said: The whole point of TImageCollection is to provide images of different sizes/resolutions, and then TVirtualImageList presents those images at a given size/resolution. It also scales the image if the requested size is not present. Share this post Link to post
dwrbudr 9 Posted 17 hours ago I think TVirtualImageList is automatically scaled when DPI changes only when TVirtualImageList is placed on a TForm/TFrame (look for SendChangeScaleMessage in the VCL code). So you'll have to override the panel ChangeScale method and set the image list size. Share this post Link to post