Home Forums WinForms controls Xceed Grid for WinForms GetFittedWidth

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • User (Old forums)
    Member
    Post count: 23064
    #16846 |

    I have noticed that the GetFittedWidth function evaluates the Column Title as well as the contents of the column even if the Wordwrap option is set to true for the column.

    What this causes is that if I have a Column Title that = “Refund Amount” and the column contains values that are rangin from 0.00 to 5.00, and the Word Wrap is on the the column title should look like this,

    Refund
    Amount

    But calling GetFittedWidth for the column returns a value that evaluates Refund Amount as a full line and not the word wrapped version.  It is as if the function does not know that the fixed header row is in word wrap mode.  Is there a way to get it to evaluate the word wrap setting?

    I only want it to return the width necessary to fit the data in columns, then I can adjust the width to be wide enough for both the data and the longest word in the title.

     

    Imported from legacy forums. Posted by Brian (had 2739 views)

    User (Old forums)
    Member
    Post count: 23064

    The GetFittedWidth will not work with WordWrap, it has to be one or the other.

    The only solution I see would be to get the width of each value of the column manually, keeping the value of the largest, and then adjust the column width accordingly to this value, or to the width of the wrapped column header, which ever is the largest value.

    Imported from legacy forums. Posted by André (had 246 views)

    User (Old forums)
    Member
    Post count: 23064

    I ended up getting the longest string in the title, setting the column title to that string, then calling getfittedwidth, then restoring the title text.  This works like I want it to.  I can then choose the longer of the two for the column width.

     

    Could I suggest that the GetFittedWidth either handle wordwrap or accept a parameter or have a GetFittedWidth that ignors the Title?  This would make the grid control even more flexible!!  Plus you would be my hero!

     

    Imported from legacy forums. Posted by Brian (had 490 views)

    User (Old forums)
    Member
    Post count: 23064

    You could also replace the title with an empty sting, get the FittedWidth, then compare the result with the width of the original title.

    Imported from legacy forums. Posted by André (had 2992 views)

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.