Results 1 to 6 of 6

Thread: Printing a picture containing text

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Jan 2001
    Location
    Denmark
    Posts
    1,049

    Printing a picture containing text

    I have a problem regarding printing of text included in a picture box. I have used the following code:
    Code:
    Private Sub Command1_Click()
        Picture1.Cls
        Picture1.FontName = "arial"
        'Printer.Print ; Tab(10); ""
        Picture1.FontSize = 10
        Picture1.Print ; Tab(10); "Date: "; Date
        Picture1.Print ; Tab(10); "Project name: "
        Picture1.Print ; Tab(10); "Project number: "
        Picture1.FontSize = 16
        Picture1.FontBold = True
        Picture1.Print ; Tab(10); ""
        Picture1.Print ; Tab(6.5); "Test of print"
        Picture1.Print ; Tab(10); ""
    End Sub
    
    Private Sub Command2_Click()
    PrintForm
    End Sub
    The text appears in the picture box on the screen, but when printing it is empty. Is it necessary to use the printer.print - notation for all instaed?

  2. #2
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    This should do the trick :

    Code:
        Printer.PaintPicture Picture1.Image, (Printer.Width - Picture1.Width) \ 2, 0 
        Printer.EndDoc

    - jamie
    Last edited by plenderj; Jun 21st, 2001 at 03:03 AM.
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  3. #3
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141
    I don't have my printer on now so I can't test this but make sure the auto redraw property is set to true for both the form and the picture box.

  4. #4
    Hyperactive Member Libero's Avatar
    Join Date
    Jun 2000
    Location
    Swedish viking
    Posts
    460
    I did like this and it workes fine:


    Printer.PaintPicture Picture1.Image, (Printer.Width - Picture1.Width) \ 2, 0
    Printer.EndDoc

  5. #5
    Retired VBF Adm1nistrator plenderj's Avatar
    Join Date
    Jan 2001
    Location
    Dublin, Ireland
    Posts
    10,359
    Thats exactly what I said libero.
    You copy-cat ..... er
    Microsoft MVP : Visual Developer - Visual Basic [2004-2005]

  6. #6
    Hyperactive Member Libero's Avatar
    Join Date
    Jun 2000
    Location
    Swedish viking
    Posts
    460
    > Plenderj Oooops! Thats my only comment right now. Next time i scroll the mouse.....

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