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. Image for the cookie policy date

Datagrid Column Alignment

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

1 Reply

CB Clay Burch Syncfusion Team 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.

Loader.
Live Chat Icon For mobile
Up arrow icon