0

Unfortunately Delphi does not scale TSpeedButton.Glyph. The button surface scaled, but the size of the glyph stay the original. I use the naive approach to scale the bitmap by TCanvas.StretchDraw but the result is disgusting. I search the internet and I found the GDI+ library where I can define the quality. The soul of the solution is the TIGPGraphics.DrawImage( image, .... ) But here image is an TIGPImage instance. It has no constructor with a TBitmap parameter, it has no property to copy a TBitmap into it. I don't want to stream the bitmap just to pass it for the TIGPImage constructor. Can somebody help me to create the GP image by a TBitmap contents and stretched draw it to another TBitmap (SpeedButtonX.glyph). I don't stick to GDI plus, I interested in other solutions as well while the result will be better then with TCanvas.StrechDraw.

I downloaded the GPIPlusMod library from here : https://github.com/jackdp/IGDIPlusMod

dummzeuch
  • 10,975
  • 4
  • 51
  • 158
SOLID Developper
  • 672
  • 4
  • 12
  • In my experience I always add a TGlyph to a TSpeedButton. It allows me to place it where I want and resize it how I want. – Adriaan Mar 08 '23 at 18:23
  • 1
    Have you considered using the `Images`+`ImageIndex` properties instead of `Glyph`? That way, you can assign a `TVirtualImageList` to the button and let it handle scaling images for you. [Supporting high-DPI images with the Image Collection and Virtual ImageList components](https://docwiki.embarcadero.com/RADStudio/en/Supporting_high-DPI_images_with_the_Image_Collection_and_Virtual_ImageList_components) – Remy Lebeau Mar 08 '23 at 18:42
  • @RemyLebeau The program now uses static glyphs on the TSpeedButtons. But if TVirtualImageList does the work I modify the prog. The program uses TImageLists as well. Should I replace them with virtual ones? – SOLID Developper Mar 08 '23 at 18:46
  • @SOLIDDevelopper read the documentation I linked to – Remy Lebeau Mar 08 '23 at 18:57

1 Answers1

-1

Check my answer here how to resize a bitmap with interpolation:

Nicely scale image

dwrbudr
  • 607
  • 4
  • 8