Solved

DataGridView Column Header Alignment

Posted on 2009-06-29
2
892 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
In this video, viewers are given an introduction to using the Windows 10 Snipping Tool, how to quickly locate it when it's needed and also how make it always available with a single click of a mouse button, by pinning it to the Desktop Task Bar. Int…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

707 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