Solved

DataGridView Column Header Alignment

Posted on 2009-06-29
2
883 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

DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Need help on C# Linq query on object 6 53
ASP.NET 5 Templates 2 68
Vb. Net application freezes 9 31
compare between entities in entity framework 8 12
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

863 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

24 Experts available now in Live!

Get 1:1 Help Now