Click to See Complete Forum and Search --> : Wordwrap or Multiline Datagrids?


nolc
March 25th, 2003, 10:57 AM
Has anyone figured out how to give the ability to Wordwrap or Multiline a Datagrid's column? What I will probably do is set columns to different/same column width then have the ability for each column to have Wordwrap or Multiline. Thanks in advanced!!!!

pareshgh
March 25th, 2003, 01:02 PM
only thing that i think of is use Format/FormatInfo of DataGridTextBoxColumn.
you can always check the size of the box and wrap it manually.

Paresh

nolc
March 25th, 2003, 01:36 PM
Do you have or know of any examples of the DataGridTextBoxColumn?

pareshgh
March 25th, 2003, 01:42 PM
public class MyDataGridTextBoxColumn : DataGridTextBoxColumn
{

private void HandleKeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
}

/// blah blah events

}

and now some where in your code,

MyDataGridTextBoxColumn aColumnTextColumn = new MyDataGridTextBoxColumn() ;

aColumnTextColumn.HeaderText = ...
aColumnTextColumn.MappingName = ....

tableStyle.GridColumnStyles.Add(aColumnTextColumn);

you can add this tableStyle to current datagrid by

dataGridMyGrid.TableStyles.Add(tableStyle); // you can add as much styles you want and thus randomly chaning the styles at run time also.


-Paresh