• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 520
  • Last Modified:

DataGrid Column Right Align Caption Text Getting Cut Off

I have a datagrid that I want to align the values to the right.  The number in the grid look correct however in the caption the T in Amount is getting cut off.  I have tried adding spaces before and after the caption text but nothing seems to work.  Any help would be greatly appreciated.
0
d_potts
Asked:
d_potts
  • 3
  • 2
2 Solutions
 
d_pottsAuthor Commented:
Side Note.  I have the onPaint in the Datagrid overwritten.  Could this have something do with it.
0
 
d_pottsAuthor Commented:
Sorry I ment in the DatagridColumnsSysle for the textbox column
0
 
SanclerCommented:
Assuming that the caption you refer to is the column header - DataColumn.ColumnName - I've not seen this before.  

1) What is in the overriding of the DataGrid.OnPaint?

And what happens if

2) you increase the width of the column?

or

3) change the font to non-proportional - e.g Courier New?

Roger
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
amyhxuCommented:
Hi d_potts,

I've seen this same question many times in this forum. That is a known problem with datagrid. Check out these links:

http://www.experts-exchange.com/Programming/Programming_Languages/C_Sharp/Q_21282822.html
http://www.experts-exchange.com/Programming/Programming_Languages/Dot_Net/Q_20621437.html
0
 
SanclerCommented:
amyhxu

So it is.  I must never have right-aligned the rightmost column before.  Having now tested doing so, I see the problem.

d_potts

If you don't want to shift the Amount column further left in the grid, a workaround seems to be to rightpad the Amount with, e.g., a single point - "Amount."  Spaces just seem to get stripped off, but you can us any character that is narrow enough to get hidden and leave just the "Amount" showing.  A point worked on my test, but it will no doubt be a function of what font you're using.

Roger
0
 
d_pottsAuthor Commented:
Thanks Guys.   I never though to use a '.'  I tried spaces and they never worked.  It's things like this in .NEt that drive me nuts.
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 3
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now