Click to See Complete Forum and Search --> : Formatted Printing in VB.NET
peakinfo
December 4th, 2002, 03:07 PM
Does anyone know of a reference that pulls together all the pieces of the .NET Framework to explain how to do the same kind of formatted printing you used to do with the Printer object in VB6? -- Things such as Printer.CurrentX and Printer.CurrentY to position the next insertion point on a page, Printer.Print, Printer.NewPage, Printer.EndDoc. .NET breaks the Printer and if you want to do formatted printing you have to find all the pieces and put them back together. The 5 .NET books I have only contain references to dumping a file to the printer.
Athley
December 4th, 2002, 04:09 PM
If I understand the question correctly this might help you...... it sure helped me.....
I'm not really sure what you mean with formatted printing, but this helped me print a page with pictures, different strings formated with different fonts and colors and so on.....
Simple printing (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnvssamp/html/vbcs_SimplePrinting.asp)
/Leyan
peakinfo
December 4th, 2002, 04:30 PM
Athley,
Yes, I downloaded that package some time ago from Microsoft and looked at it. It contains some helpful information, but basically what it's doing is taking a file -- which in this case happens to be in a text box -- and dumping it out, line by line, to the printer. I understand how to do that thanks to that sample and to some of the VB .NET books I have.
What I need to do is this: Say you want to construct a form from inside your program. To do this you need to be able to move around the virtual page in memory and print various lines, then send the whole thing to the physical printer. You do that in vb 6 by saying something like "Printer.CurrentX = 850; Printer.CurrentY = 1024; Printer.Print strMyString." Then you move somewhere else on the form and print again. You may even print some lines to emphasize some of the printing. When you're finished with the page you say, "Printer.NewPage" (or, if that's the only page you're going to print you say, "Printer.EndDoc."
I'm sure it's quite possible to do that out of VB .NET, but there are a bunch of classes that have to be pulled together to do things like setting the font, moving to a position, printing a string, and ejecting the page. Part of the answer is in the Microsoft file you referenced. That tells you how to print a virtual page in memory and dump it out, but the positioning, etc. isn't there. I'm looking for something that gives shows how to do it all.
Regards
Athley
December 5th, 2002, 02:14 AM
Isn't there only one client rectangle for printing in that example? And then couldnt you work out the positioning with more than one rectangle?
In the last project I made I had to print everything to specific positions and some dynamic positions all over the actual page and I saw no problem with that.
/Leyan
peakinfo
December 5th, 2002, 05:08 AM
Athley,
I suspect you may be right. I'll try using rectangles and see if that doesn't do what I want. Seems to me I remember having to use rectangles for something like that when programming Windows in C.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.