CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5
  1. #1
    Join Date
    Dec 2002
    Location
    Colorado Springs, Colorado, USA
    Posts
    3

    Formatted Printing in VB.NET

    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.

  2. #2
    Join Date
    Oct 2002
    Location
    Växjö, Sweden
    Posts
    225
    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

    /Leyan

  3. #3
    Join Date
    Dec 2002
    Location
    Colorado Springs, Colorado, USA
    Posts
    3

    Thanks

    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

  4. #4
    Join Date
    Oct 2002
    Location
    Växjö, Sweden
    Posts
    225
    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

  5. #5
    Join Date
    Dec 2002
    Location
    Colorado Springs, Colorado, USA
    Posts
    3

    Again -- Thanks

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured