开发者

How does a DBGrid component determine initial column widths to display?

开发者 https://www.devze.com 2023-02-20 13:50 出处:网络
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 ca

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号