Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
250
Custom Cell Painting and Auto Size
posted

Hello,

In my control, which inherits from UltraGrid, I implement IUIElementDrawFilter interface to do custom painting of the cells.

I also want to be able to override the preferred cell size to be used when user clicks to perforn auto-sizing of the column.

By default, the grid uses some kind of internal mechanism to determine the preferred cell size (maybe something like Graphics.MeasureString(Cell.Value.ToString()) / not exacly these methods, but you get my idea).

Please let me know if you know how to override the preferred cell size.

Cheers,
Andrey

 

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi Andrey,

    The grid gets the size of each cell from the editor in that call. So the only way I can think of to do something like this would be to derive your own editor class. Perhaps you could derive from one of the existing editors and override the GetIdealSize method and use the derived editor for the column. Which editor you use depends on the data type of the column and what you are displaying. You might want to look at the EditorResolved property of a cell in the existing column and see what type of editor it is already using and then derive from that. 

     

Children