Solved

DataGridView Column Header Alignment

Posted on 2009-06-29
2
879 Views
Last Modified: 2012-05-07
I've found a lot of answers on how to align the Header Text for a column but when I set the HeaderText to MiddleRight alignment, there is some sort of padding after the Header text that I can't figure out how to get rid of.  Since this is hard to describe, I've posted a sample picture with the problem
dgvUndoImportInfo.Columns[0].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleLeft;

            dgvUndoImportInfo.Columns[1].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;

            dgvUndoImportInfo.Columns[2].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;

            dgvUndoImportInfo.Columns[3].HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleRight;

Open in new window

undo.png
0
Comment
Question by:Adnan
2 Comments
 

Accepted Solution

by:
ninusajil earned 500 total points
ID: 24735484
iam not sure what do u mean, anyway please look at this comment

give this in column of the grid as

 <asp:TemplateField HeaderText="sum imported">
                        <ItemStyle HorizontalAlign="Right"  VerticalAlign ="Middle" />
                        <HeaderStyle HorizontalAlign="Right" Width="2%" />
                        <ItemTemplate>

                        </ItemTemplate>
                        </asp:TemplateField>

specify the widht also
0
 

Author Comment

by:Adnan
ID: 24735500
you can se the column "Sum imported" , alignment on this column is set to middlerigth, but still there are some space after the text.....i hope u understand it now...take a look at the picture...
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In my previous article (http://www.experts-exchange.com/Programming/Languages/.NET/.NET_Framework_3.x/A_4362-Serialization-in-NET-1.html) we saw the basics of serialization and how types/objects can be serialized to Binary format. In this blog we wi…
For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.
You have products, that come in variants and want to set different prices for them? Watch this micro tutorial that describes how to configure prices for Magento super attributes. Assigning simple products to configurable: We assigned simple products…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now