Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Header Alignment
Message
From
26/07/2004 11:37:21
 
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00927935
Message ID:
00927939
Views:
14
Gary,

Assuming your talking about Winforms...I don't know of an easy way to do it. It seems the alignment property applied to both the column data and column heading.

If anyone knows of an easy way, I'd love to know as well. This very question has appeared on other message boards, but I've never seen an easy answer.

There is a way to do it through code, though it's a bit involved. You could set the alignment based on what you want the heading to be.

Then you could create your own datagridcolumn class, and override the paint method. In the paint method, you could capture the data for the cell being painted (by using GetColumnValueAtRow), and use the drawstring function after calculating how much space you'd want to have to the right or left by using the measurestring function (based on whether you want to center, right align, etc.) So the end result would be a heading aligned one way and the data aligned another way.

I know, that's a mouthful. I've done this, for a function where I wanted to replicate the 'dynamicforecolor' capability that's in VFP. It didn't affect performance that I could see, though I'm only doing it for certain columns.


Kevin
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform