|
Re: How can I possibly right align a text using drawString method
I agree with live_wire. But we can come up with a work around for this problem.
First calculate the length of the string and how many pixels each character will take. Based on this, arrange your string position. i.e., if L is the total available length, and X is number of pixels for each character and if you have N characters to be placed or painted, formula to find the starting point looks like this.
Startpoint = L - (N*X)
Hope it helps you to some extent. If you find any other solution, please let us know.
Here, I am not handling the case where starting point goes negative. But solving it is not an issue.
Thanks,
Krishna
__________________
Give 1 cup rice to a hungry Indian just by a mouse click. No money, no form filling, no hassle... Click here for the donation.
|