开发者

DataGridView auto size columns without showing the grid

开发者 https://www.devze.com 2022-12-21 05:57 出处:网络
I need to get DataGridView column sizes without showing the the grid (for printing). I\'m using data binding through DataSource (using BindingSource doesn\'t seem to work too).

I need to get DataGridView column sizes without showing the the grid (for printing). I'm using data binding through DataSource (using BindingSource doesn't seem to work too).

For whatever reason I get wrong column sizes. If I show t开发者_如何学Gohe grid in a form first, everything is fine. If I try to get column sizes after setting no DataSource and executing AutoResizeColumns(), columns are too wide (didn't autosize).

How can I force grid to do it's job without showing it?


Fixed. Use CreateControl() to initialize control, binding, handle, etc.

0

精彩评论

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