TrialUser
asked on
dynamically set datagridview row height
I display some text in of the field in the datagridview. Is it possible to increase the row height only to the rows where this field wraps to the second line. That is whenever the text is longer and cant be displayed in one line it gets wrapped and displayed in two lines in the cell.
How can I detect this and increase the row height. Thanks. Please help.
How can I detect this and increase the row height. Thanks. Please help.
ASKER
If I set the Autoresize to DisplayedCells, the rows are getting autoresized. However I have set the Height of the Rows in the RowTemplate to say 50. Iwouldlike for therows to have this as theminimum height. Only in thecases when the text wraps to thesecond line, I would like for the row to have autoresize property. In other words is it possible to set minimum height for the rows?
Thanks
Thanks
Ok, this is an additional requirement to your question:
DataGridViewRow has a property MinimumHeight that maintains the display of the row by setting a limit to how far the user can resize the row's height through the user interface (UI).
DataGridViewRow has a property MinimumHeight that maintains the display of the row by setting a limit to how far the user can resize the row's height through the user interface (UI).
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
for (int i = 0; i < this.dataGridView1.Rows.Co
{
this.dataGridView1.AutoRes
}
or set your grid AutoSizeRowsMode property to:
AutoSizeRowsMode = System.Windows.Forms.DataG
Can you tell me what AutoSizeRowsMode property is set on your grid?
http://msdn.microsoft.com/en-us/library/system.windows.forms.datagridviewautosizerowsmode.aspx