Wrap Winforms DataGrid header

G

Guest

I'm looking for a way to wrap a text in Winforms DataGrid header (see below).
I know it can be done to the cells in the grid by overriding the paint method
but i can't seem to find a similar way to handle the column headers. Any help
would be much appreciated.

ex: _______________________
|Column1 |Really Long Column 2|

desired format
|Column1 |Really Long|
| |Column 2 |

Regards

Dave
 
G

Guest

First set the HeaderText for the columns in code, eg

dataGridBoolColumn2.HeaderText = "Really Long\nColumn 2";

Next, set the dataGrid1.HeaderFont to a larger font. This increases the
height of the Headers, but the Headers are still displayed using the
dataGrid1.TableStyles[ 0 ].HeaderFont font.

Regards,
Phil.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top