translating on-screen width to printed width
-
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?
-
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?
Sometimes I have found that problems like this have been caused by the difference in
dpi
between the screen Graphics and the printer Graphics objects. Not always though but it is worth looking at.Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
-
Sometimes I have found that problems like this have been caused by the difference in
dpi
between the screen Graphics and the printer Graphics objects. Not always though but it is worth looking at.Henry Minute Do not read medical books! You could die of a misprint. - Mark Twain Girl: (staring) "Why do you need an icy cucumber?" “I want to report a fraud. The government is lying to us all.”
They appear to be the same, when I look at the printerresolutions collection.