Dave's Brain

Browse - Programming Tips - How do I right align text with GDI+?

Date: 2015apr27
OS: Windows
Product: GDI+
Language: C++

Q.  How do I right align text with GDI+?

A.  Use StringAlignmentFar.
(To left align use StringAlignmentNear.)

I suppose they use near/far to handle languages which read the opposite
direction to English.

StringFormat format; format.SetAlignment(StringAlignmentFar); graphics.DrawString( ..., ..., ..., ..., &format, ...);

Add a comment

Sign in to add a comment
Copyright © 2008-2017, dave - Code samples on Dave's Brain is licensed under the Creative Commons Attribution 2.5 License. However other material, including English text has all rights reserved.