Mark Wills
Member
Hi there.
I am working on a VB.Net application (WinForms) and all is working fine. I'm just putting the finishing touches to it, and am now working on a Print function.
The application is a code editor, and of course, one of the facilities is to be able to print the code that one has written. I have consulted the MSDN documentation, and, with it's help, I have managed to write a well behaved routine that does indeed print to the printer, using the PrintDocument_PrintPage event.
However, there is one problem - some lines that are longer than the page width are 'clipped' and thus there is test missing from the printout.
I need someway to know if a line of text is too long, and if so, at which point do I split the string?
I have seen a reference to MeasureString on this page: http://www.startvbdotnet.com/controls/printdialog1.aspx
However, the code as presented on the above site is broken (there is part of a line missing) and I can't reconstruct his code.
Can anyone suggest a method providing a printout without text being clipped? The text should ust wrap to the next line.
Many thanks
Mark Wills UK
I am working on a VB.Net application (WinForms) and all is working fine. I'm just putting the finishing touches to it, and am now working on a Print function.
The application is a code editor, and of course, one of the facilities is to be able to print the code that one has written. I have consulted the MSDN documentation, and, with it's help, I have managed to write a well behaved routine that does indeed print to the printer, using the PrintDocument_PrintPage event.
However, there is one problem - some lines that are longer than the page width are 'clipped' and thus there is test missing from the printout.
I need someway to know if a line of text is too long, and if so, at which point do I split the string?
I have seen a reference to MeasureString on this page: http://www.startvbdotnet.com/controls/printdialog1.aspx
However, the code as presented on the above site is broken (there is part of a line missing) and I can't reconstruct his code.
Can anyone suggest a method providing a printout without text being clipped? The text should ust wrap to the next line.
Many thanks
Mark Wills UK