开发者

DataGridView auto size columns without showing the grid

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜