• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 522
  • 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
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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