问题
I'm working with Embarcadero C++Builder. I'm using the TSpeedButton
component with a .bmp
image.
No matter what format I try, everything looks great in the IDE, but when I compile and generate the .exe
file and then start the application, there are no images. There is the text with a small white square on the TSpeedButton
. I have tried the .png
, .jpg
, .bmp
, .ico
formats. Is there any solution to my issue?.
回答1:
TSpeedButton has property NumGlyphs
which indicates how many images Glyph
contains. If you have only one image, then set NumGlyphs = 1
.
Additionally, you can have separate images for disabled, hovered and pressed (down) buttons. In that case, multiple images are stored on the same bitmap next to each other in a horizontal raw; every image must have the same size. For instance, a bitmap 128x32px provides 4 images, 32x32px each.
Worth of mention that the bottom-left pixel indicates the transparent color, i.e., pixels of that color do not get drawn.
回答2:
I have find the solution of my issue. it was just a problem of compatibility mode applied by default by windows 10. I have just disabled the running of the application under compatibility mode Win XP SP2 and then no showing issue.
Thanks for all your support.
来源:https://stackoverflow.com/questions/60151358/image-not-showing-in-tspeedbutton