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.

Datagrid Column Alignment

Thread ID:





418 Jun 25,2002 06:33 AM Jun 25,2002 07:35 AM Windows Forms 1
Tags: FAQ
Vipul Bhatt
Asked On June 25, 2002 06:33 AM

How can I have column headers center alignment while its text being left/right aligned

Clay Burch [Syncfusion]
Replied On June 25, 2002 07:35 AM

The center alignment for the headers appears to be broken. In an posting on microsoft.public.dotnet.framework.windowsforms on 5/23/02, Daniel Herling [MS] stated that this was a known bug, and they intended to fix it in a future release. If you need to center the text before the fix is released, you might try adding some leading blanks as part of the headertext. You could even write a method that would add enough blanks so the text is more or less centered. To do this, you would need to get the column width, and call Measure String on the headertext. You could repeatedly add blanks and call MeasureString until the string would be close to center.


This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

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.