Quantcast
Channel: Windows Forms Data Controls and Databinding forum
Viewing all articles
Browse latest Browse all 2535

How To Get the Actual Displayed Width of a DataGridViewColumn When Using Column AutoSize

$
0
0

I am trying to produce what look like multi-column headers over a DataGridView (DGV) by using a TableLayoutPanel (TLP) that sits over the DGV as vaguely described in a response by Samus Arin at the bottom of this post: http://social.msdn.microsoft.com/Forums/windows/en-US/e6328cee-1972-496f-a550-697ab89ed387/datagridview-multiple-column-headers?forum=winformsdesigner .  Seems like a pretty clever solution. 

The challenge I'm facing is that I want the columns of the DGV to auto resize and therefore need to programmatically get the actual displayed width of the columns so I can mirror that width in the cells of the TLP.  I'm not sure this whole approach will work in the end, but for now I'm stuck on how to get the displayed width of the columns (versus the nominal width that I get from the DataGridViewColumn.Width property).

Is there a way to get the actual displayed width of DGV columns with AutoSize?  Beyond that, if you have thoughts on my broader objective, I'm all ears.

Thanks.  Steve


Viewing all articles
Browse latest Browse all 2535

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>