I recently changed the default text rendering mode to GDI but I want to provide a user option to toggle it in case any users complain
Changing the mode does immediately update the text displayed in the cells correctly, but not the cell dimensions - the GDI+ version of the font is taller and slightly less wide. If the grid is recreated with the new setting it is very noticeably a different size.
However I can't force the grid to recalculate the size of the cells using the new text mode, I've tried various combinations of:
All to no avail, the cells always remain the same size.
Also I concur with previous posts about how rubbish GDI+ looks (how on earth does the same font + size draw differently), even the infragistics menus look different from every other windows app because of this, and the ridiculous switching between edit mode means I have to disable it for everything.
thanks
Martin
No, there's no such method at the Layout level. You have to call PerformAutoSize on each row. Actually, though, it depends on the your RowSizing settings. By default, all rows in the grid are the same height, so you probably only need to call PerformAutoSize on the first row in the grid and that should handle all other rows.
Thanks Mike, I'll do that.
Note that the font and therefore cell height changes aswell, I notice the corresponding PerformAutoResizeRows doesn't exist tho...
Cells in the grid do not autosize based on the font, except once the first time they paint. So the code you have here won't work. If you want to autosize a column to it's contents, you need to call the PerformAutoResize method on the column. There is also a PerformAutoSize method on the row to adjust the height.
The latest version of the grid has methods like PerformAutoSizeColumns on the band and the layout, so you size all of the columns at once.