CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6
  1. #1
    Join Date
    Jul 2002
    Posts
    72

    Printing controls in a picturebox

    In the following example, how does one setup the printer for printing a shape, Line and picturebox object.

    For each ctrl In myScreen.controls
    If ctrl.container.name = "myPictureBox" then
    If TypeOf ctrl is TextBox then
    Printer.currentX = ctrl.left
    Printer.currentY = ctrl.top
    Printer.Print ctrl
    ElseIf TypeOf ctrl is Shape then
    ???
    ElseIf TypeOf ctrl is Line then
    ???
    ElseIf TypeOf ctrl is Picture then
    ??
    End If
    End If
    Printer.EndDoc
    Next

  2. #2
    Join Date
    Dec 2001
    Posts
    6,332

    Re: Printing controls in a picturebox

    It would probably be much easier to take a screen capture of the area you want to print, and send that to the printer.
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  3. #3
    Join Date
    Jul 2002
    Posts
    72

    Re: Printing controls in a picturebox

    The area I need to capture and send to the printer is larger than the screen. It will print out a complete 8.5 x 11 inch document. I'm working with the keybd_event API, setting the form to the size of the area I am trying to capture (which exceeds the window screen), and then trying to capture all of the form with keybd_event VK_SNAPSHOT, 1&, 0&, 0&. I'm only able to capture what is visible on the screen and not all of the form. Is it possible to capture all of the form, even though it is not all showing on the screen?

  4. #4
    Join Date
    Dec 2001
    Posts
    6,332

    Re: Printing controls in a picturebox

    If you want to print an entire form, perhaps the PrintForm method will work for you. For a picturebox only, you may find this post I made to be helpfull: http://www.codeguru.com/forum/showth...16#post1011416
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

  5. #5
    Join Date
    Jul 2002
    Posts
    72

    Re: Printing controls in a picturebox

    The code you attached was along the lines of what I need to do but I cannot figure out how to get there. Basically, I need to take the objects in one picture box and make them the picture of another picture box. That way, I can do a printout with PaintPicture. Any suggestions?

  6. #6
    Join Date
    Dec 2001
    Posts
    6,332

    Re: Printing controls in a picturebox

    If there will only be text, lines, shapes, and images, I'd likely draw those elements via API, thus they will be part of the image.
    Please remember to rate the posts and threads that you find useful.
    How can something be both new and improved at the same time?

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