We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

How to right align the text according to the font?

In the Grid, the degree of the alignment varies from font to font. You can derive your own cell model and override the CellRenderer's OnDraw method. In the override, the text rectangle is adjusted to appropriately align the text. To right align the Grid, you need to follow the steps given:

 

Step 1: Create CellModel.

C#

VB

 

Step 2: Create CellRenderer.

C#

VB

 

Step 3: Add CellModel to the Grid.

C#

VB

 

Step 4: Setup for Antialias.

C#

 VB

 

Step 5: Events to perform desire operation.

C#

VB

The following screenshot displays the Grid with right alignment.

Figure 1: Right Text Align for different texts

 

Sample Links

CS: RightTextAlignment

VB: RightTextAlignment

Article ID: Published Date: Last Revised Date: Platform: Control:
417 04/30/2011 02/12/2016 Windows Forms GridControl
Tags:
Did you find this information helpful?
Add Comment
You must log in to leave a comment

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.