-
ou81aswell said 1 year, 5 months ago:
Is there a way to autosize a row as it is being edited? I would like to increase the row height if the user enters multiple lines of text in a particular cell.
Thanks.
| # -
Hello,
You can handle the KeyDownEdit event of the flexgrid and if he is entering multiple lines then can increase the height of the textbox. Here is the code for same:
VB
Private Sub C1FlexGrid1_KeyDownEdit(sender As Object, e As C1.Win.C1FlexGrid.KeyEditEventArgs) Handles C1FlexGrid1.KeyDownEdit If e.KeyCode = Keys.Enter And e.Shift Then ' This is to check whether text cursor is on the last line or not Dim txtbx As TextBox = C1FlexGrid1.Editor If (txtbx.Lines.Length – 1) = txtbx.GetLineFromCharIndex(txtbx.GetFirstCharIndexOfCurrentLine) Then C1FlexGrid1.Rows(e.Row).Height += 20 End If End If End SubC#
private void C1FlexGrid1_KeyDownEdit(object sender, C1.Win.C1FlexGrid.KeyEditEventArgs e) { if (e.KeyCode == Keys.Enter & e.Shift) { // This is to check whether text cursor is on the last line or not TextBox txtbx = C1FlexGrid1.Editor; if ((txtbx.Lines.Length – 1) == txtbx.GetLineFromCharIndex(txtbx.GetFirstCharIndexOfCurrentLine)) { C1FlexGrid1.Rows(e.Row).Height += 20; } } }Regards
AshishAnswer| # -
ou81aswell said 1 year, 5 months ago:
Great! I was close. I was resizing the row on the keydownedit event. Of course, this didn’t resize the textbox. Many thanks (again).
Cheers!
| # -
ou81aswell said 1 year, 5 months ago:
Out of interest, how does one copy and paste the code fragments above. I used a simple copy / paste from IE9 to my text editor (VS 2010) but the code ended up on a single line.
| # -
Hello,
Yes, it seems to some issue with IE. I have escalated it to the concerned team for review, in between, you can use any other browser for same.
Regards
Ashish| #
You must be logged in to reply to this topic.

