View Single Post
Old 27-07-07, 03:43 PM   #3 (permalink)
sk_kireeti
Super Moderator
 
sk_kireeti's Avatar
 
Join Date: Feb 2006
Location: Hyderabad
Posts: 2,355
Thanks: 117
Thanked 255 Times in 206 Posts
Thanks: 117
Thanked 255 Times in 206 Posts
Blog Entries: 4
Rep Power: 53 sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute sk_kireeti has a reputation beyond repute
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.
sk_kireeti is offline   Reply With Quote
The Following User Says Thank You to sk_kireeti For This Useful Post:
ananthkolli (31-07-07)