I'm having a difficult time saving/reloa开发者_JAVA百科ding col widths in a DBGrid (actually TMS's DBGrid). TMS includes built-in methods to save/reload col widths, which are working correctly (I can read the values in an ini file). Something, somewhere in my code is overriding the stored values, however. I don't know enough about how col widths are determined to be able to debug the issue.
The grid is ultimately connected to a ClientDataSet file.
TColumn
has a method named DefaultWidth
, which is called in particular when the width hasn't been explicitly assigned to the column (which is true for the dynamically created grid columns).
Basically, it takes the column's associated field's display width (in chars) and multiplies it by the width of the 0
character (in pixels), using the corresponding font.
It then compares the result to the width of the title (in pixels) and returns the greater value.
精彩评论