How to set the star position in the button

I use the DrawableButton create a button and want to draw a star pic on it.

the result is that the star pic show correct and at the centre of the button.

however, I want to show the star at the left of the button,

so ,Please anyone can tell me how to solve it?

If you’re using ButtonStyle::ImageOnButtonBackground the image will always be centred. To do something like your example you could subclass Button and in the paintButton() method draw the button background using the drawButtonBackground() method in the LookAndFeel class and then draw a star on the left.


Thanks for your replay,
Now , I tried do this on the basis of you said ,it succeed !

we need to override the lookandfeel, we can paint all the star we want.

1 Like