-1

In delphi xe 8 tbutton's image has aligning for "left, center, right and bottom" but when i select "center" align for the image, the image is aligning in the middle of button and stays behind the caption

What i wanna do is align the image right before the caption text (like it should)

I dont know why delphi tbutton doesnt do that, is it a bug? Or delphi team wants to drive us crazy? It should be so easy but just aligning a button image causing problem?

Is there a way to align image nicely in the center with the caption?

like in the picture below

enter image description here

RRUZ
  • 134,889
  • 20
  • 356
  • 483
Emre Acikgoz
  • 93
  • 1
  • 11

3 Answers3

1

Found the solution, it is bitbtn it was very simple and it is there always in front of my eyes, apperantly bitbtn is also a wrapper for OS button, it does what i ask for and also it has canvas so drawing on it is possible

Emre Acikgoz
  • 93
  • 1
  • 11
0

The text in the button is one thing the image is another. You could hack this if you align the image to the left, and align the text in the middle. If needed add extra blank spaces in front of the text.

Bogoljub
  • 73
  • 6
0

You can replace the TButton with a TBitBtn, and use the margin property of TBitBtn to align images nicely.

The Margin property sets the distance between the edge of the button and glyph, in pixels.

More info here: https://wiki.lazarus.freepascal.org/TBitBtn

Flavio
  • 451
  • 3
  • 26