المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : translating on-screen width to printed width



C# Programming
10-29-2009, 05:00 PM
I have created an object that, given a reference to a DataGridView will print it. I have one problem with my code, however. When I double-click the column separators to get the minimum size that will display all the contents of the columns and then print, not all of the content displays in the print. I need to figure out how to translate the on-screen column width to a printed width. Now, I know some of you are thinking "use MeasureString()". That would require two passes of my data to find the longest contents of the column. That is inefficient. There has to be (read as "please let there be") a way to simply convert the column width for printing purposes.

Any ideas?