Forum > Win32/64

BitBtn - display error

<< < (2/2)

Ally:

--- Quote ---and even today they only allow me to load bmp into TBitBtn.Glyph!
--- End quote ---

Actually, this does not surprise me. TBitBtn.Glyph exists, in my opinion, only for compatibility reasons and should not be used currently.


--- Quote ---TImageList does allow me to load png, but the images now have a black background.
--- End quote ---

That surprises me now however very much. That would mean that TImageList is not useable in Delphi?

Enclosed are some "icons" for testing.

Ally:
I noticed something else.
If you look at the font in programs, greatly enlarged, you can see that the individual letters are "smoothed" with colored and transparent pixels.
This is not only done by Windows, but also by Linux, as you can see in Handoko's screenshot.
And also here the BitBtn under Windows has a problem. The caption is only "smoothed" with gray pixels, which also leads to a slight degradation of the font quality.

wp:

--- Quote from: Ally on March 01, 2022, 02:57:41 pm ---TBitBtn.Glyph exists, in my opinion, only for compatibility reasons and should not be used currently.
--- End quote ---
Not for Delphi where TBitBtn does not use an imagelist.


--- Quote from: Ally on March 01, 2022, 02:57:41 pm ---That would mean that TImageList is not useable in Delphi?

--- End quote ---
I remember that I had used TPngImageList in my Delphi7 days for this reason. But I am surprised that this did not change during the past 25 years.

However, things become a bit better when I add the images at runtime. When I load the png file into a TPngImage, assign it to a TBitmap and load that into a TImageList, the icon is displayed on a TButton correctly - similar to our TSpeedButton. On the other hand, when I assign the png to the Glyph of a TBitBtn I get an extremely low-quality image.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.FormCreate(Sender: TObject);var  png: TPngImage;  bmp: TBitmap;begin  png := TPngObject.Create;  try    png.LoadfromFile('D:\Prog_Lazarus\thirdparty_components\button_icons\Icon3-16.png');    bmp := TBitmap.Create;    try      bmp.Assign(png);      ImageList1.Add(bmp, nil);    finally      bmp.Free;    end;    BitBtn1.Glyph.Assign(png);  finally    png.Free;  end;end;
No, Delphi really is not a bench-mark here...

Ally:

--- Quote ---Not for Delphi where TBitBtn does not use an imagelist.
--- End quote ---

So Lazarus has the nose clearly in front. And the whole thing also with ImageList.Scaled, HighDPI capable.


--- Quote ---I remember that I had used TPngImageList in my Delphi7 days for this reason. But I am surprised that this did not change during the past 25 years.
--- End quote ---

Yes, exactly, I still maintain two old Delphi programs and there I also use TPngImageList.


--- Quote ---On the other hand, when I assign the png to the Glyph of a TBitBtn I get an extremely low-quality image.
--- End quote ---

But at least in both cases the caption is displayed correctly.

Navigation

[0] Message Index

[*] Previous page

Go to full version