How to use PrintDocument
-
I have created a form in a tabcontrol -> tabpage, it has a contract format and I need to print it. So, I heard about PrintDocument but I don't really know how should I use it to print a tabpage because it has a large height and it should be printed on multiple pages. Any suggestions please? Thanks
-
I have created a form in a tabcontrol -> tabpage, it has a contract format and I need to print it. So, I heard about PrintDocument but I don't really know how should I use it to print a tabpage because it has a large height and it should be printed on multiple pages. Any suggestions please? Thanks
That's what a PrintDocument is for - it allows you to select exactly what is printed, and where it is printed, in what font, what colours, etc. What it doesn't do is "print a control" such as a tap page - because that's silly. The control is very unlikely to conform to the form factor of the paper being printed onto (and it'll have a "screen based" resolution rather than a "printout based" resolution, which is generally a lot, lot higher. Have a look at the documentation: https://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument(v=vs.110).aspx[^] - it includes a simple example.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
That's what a PrintDocument is for - it allows you to select exactly what is printed, and where it is printed, in what font, what colours, etc. What it doesn't do is "print a control" such as a tap page - because that's silly. The control is very unlikely to conform to the form factor of the paper being printed onto (and it'll have a "screen based" resolution rather than a "printout based" resolution, which is generally a lot, lot higher. Have a look at the documentation: https://msdn.microsoft.com/en-us/library/system.drawing.printing.printdocument(v=vs.110).aspx[^] - it includes a simple example.
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
Well, which is the right way to print a form with textboxes, labels in a specific location in form? In that example it prints a text file. But in that way, it prints the whole windows form. Or, is there any third way? For example to send data in a word document?
-
Well, which is the right way to print a form with textboxes, labels in a specific location in form? In that example it prints a text file. But in that way, it prints the whole windows form. Or, is there any third way? For example to send data in a word document?
Why would you want to print text boxes? Do you expect the user to type in them? :laugh:
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
Why would you want to print text boxes? Do you expect the user to type in them? :laugh:
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
No, I mean the shape of textbox..I have to print a specific design of the form, as I said, its format is as a contract..it's not just some simple text..
If you look at the example, it draws the text via the DrawText method of the Graphics object. A quick look at the documentation would show you there are a lot of other Draw... methods. Including lines, rectangles, circles, paths, images, filled and unfilled. So if you want a form with boxes for the user to write in, then DrawRectangle is probably a good place to start...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...
-
If you look at the example, it draws the text via the DrawText method of the Graphics object. A quick look at the documentation would show you there are a lot of other Draw... methods. Including lines, rectangles, circles, paths, images, filled and unfilled. So if you want a form with boxes for the user to write in, then DrawRectangle is probably a good place to start...
Bad command or file name. Bad, bad command! Sit! Stay! Staaaay...