How to autosize row?
Like this: when column width is invariable,and text is long, I hope it display two rows or more rows
in one cell,it can auto adjust rows height,just like datagridview's autosizerowmode.
thank you!
Currently SourceGrid supports only word wrap (wrap the text on each word).
To use this feature you must set the
View.WordWrap = true;
(maybe creating your custom view)
Then you can call
grid1.Rows.AutoSize(true);
Remember that in your case you cannot use "eeeeeeeeeeeeeeeeeeee" but something like "eeee eeee eeeeeee eeeee"
Davide
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thank you David! You are right.
But I still have some question:
1.Sometimes,we need use string just like "abcdefghijklmnopqrstuvwxyz", the string is too long,
we can not split it to "abcdefg hijk lmnop qrstuv",because the string is not smae length.
2.The string can be displayed abcdefghijk
lmnopqrstuv
wxyz
when we adjust the cell width,it can be auto display abcdefghijklmnopq
rstuvwxyz
instead of add space into string.
I mean it is auto adjust,not add space by hand or by another program.
Thank you again!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
You must write some custom code. A solution is to use the TextGDI rendering that has some advanced wrap features (there is an example in the demo project, form 3).
I think that this kind of wrap is the default of DevAge.Drawing.VisualElements.TextGDI (that use GDI+ rendering)
Davide
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
How to autosize row?
Like this: when column width is invariable,and text is long, I hope it display two rows or more rows
in one cell,it can auto adjust rows height,just like datagridview's autosizerowmode.
thank you!
1 wwwwwwwww
2 eeeeeeeee
eeeeeeeee
ee
3 dddddd
grid1[0,0]=1
gird1[0,1]="wwwwwwwww"
gird1[1,0]=2
grid1[1,1]="eeeeeeeeeeeeeeeeeeee"
grid1[2,0]=3
grid1[2,1]="dddddd"
Hi,
Currently SourceGrid supports only word wrap (wrap the text on each word).
To use this feature you must set the
View.WordWrap = true;
(maybe creating your custom view)
Then you can call
grid1.Rows.AutoSize(true);
Remember that in your case you cannot use "eeeeeeeeeeeeeeeeeeee" but something like "eeee eeee eeeeeee eeeee"
Davide
Thank you David! You are right.
But I still have some question:
1.Sometimes,we need use string just like "abcdefghijklmnopqrstuvwxyz", the string is too long,
we can not split it to "abcdefg hijk lmnop qrstuv",because the string is not smae length.
2.The string can be displayed abcdefghijk
lmnopqrstuv
wxyz
when we adjust the cell width,it can be auto display abcdefghijklmnopq
rstuvwxyz
instead of add space into string.
I mean it is auto adjust,not add space by hand or by another program.
Thank you again!
Unfortunately for now it is not possible.
You must write some custom code. A solution is to use the TextGDI rendering that has some advanced wrap features (there is an example in the demo project, form 3).
I think that this kind of wrap is the default of DevAge.Drawing.VisualElements.TextGDI (that use GDI+ rendering)
Davide
ok,thank you David,you are so kind,then I hope it can be solved next version.
I will try it according to your suggestion.