Menu

How to AutoSize Row?

Help
2006-11-22
2013-04-23
  • Nobody/Anonymous

    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"

        

     
    • Davide Icardi

      Davide Icardi - 2006-11-22

      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

       
      • Nobody/Anonymous

        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!

         
        • Davide Icardi

          Davide Icardi - 2006-11-23

          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

           
    • Nobody/Anonymous

      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.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.