Results 1 to 3 of 3

Thread: Common Dialog and custom printing

  1. #1

    Thread Starter
    Addicted Member run_GMoney's Avatar
    Join Date
    May 2002
    Location
    Detroit
    Posts
    186

    Common Dialog and custom printing

    Ok so I've got code like this:
    VB Code:
    1. Private Sub mnuPrint_Click()
    2.  
    3.     With dlgCommonDialog
    4.         .DialogTitle = "Print"
    5.         .CancelError = True
    6.         .Flags = cdlPDReturnDC + cdlPDNoPageNums
    7.         .ShowPrinter
    8.     End With
    9.        
    10. End Sub
    to bring up the Print dialog. My question is, can you then do custom printing with the Printer object after bringing up the Print dialog? I currently have a function that I call to do my printing. (It's a pretty raw solution I know but it works in a couple printers I've tried. I'm not opposed to suggestions to improve it though )

    VB Code:
    1. Private Function PrintPicture()
    2.    
    3. Form1.Picture7.Print Form1.Label7.Caption
    4. Form1.Picture5.Print Form1.Label1.Caption
    5.  
    6. Step = 200
    7. For i = 5 To 45
    8.     If Check1(i).Value = 1 Then
    9.         Form1.Picture2.Line (0, Step)-(500, Step), Check1(i).ForeColor
    10.         Form1.Picture2.Print Check1(i).Caption
    11.         Step = Step + 500
    12.     End If
    13. Next
    14.  
    15. Form1.Picture2.Line (0, 0)-(2415, 0)
    16. Form1.Picture2.Line (0, 0)-(0, Step)
    17. Form1.Picture2.Line (0, Step)-(2415, Step)
    18. Form1.Picture2.Line (2415, 0)-(2415, Step)
    19.  
    20. 'Picture2.Visible = True
    21.  
    22. Printer.PaintPicture Picture1.Image, 1000, 3500
    23. Printer.PaintPicture Form1.Picture7.Image, ((Printer.Width - Form1.Label7.Width) / 2), ((3500 - Form1.Label7.Height) / 2)
    24. Printer.PaintPicture Form1.Picture2.Image, 1000 + Picture1.Width + 50, 3500 + (Picture1.Height - (Step + 80))
    25. Printer.PaintPicture Form1.Picture3.Image, (Printer.Width - (Form1.Picture3.Width + 600)), Printer.Height - (Form1.Picture3.Height * 2)
    26. Printer.PaintPicture Form1.Picture4.Image, 100, Printer.Height - (Form1.Picture3.Height * 2)
    27. Printer.PaintPicture Form1.Picture5.Image, 1000 + Picture1.Width + 50 + ((2415 / 2) - (Form1.Label1.Width / 2)), 3500 + Picture1.Height - Step - 50 - Form1.Picture5.Height
    28.  
    29. Printer.CurrentX = 750
    30. Printer.CurrentY = 3400
    31. For i = 0 To 6
    32.     Printer.Print Label8(i).Caption
    33.     Printer.CurrentX = 700
    34.     Printer.CurrentY = Printer.CurrentY + 985
    35. Next
    36.  
    37. Printer.CurrentX = 900
    38. Printer.CurrentY = 10800
    39. For i = 13 To 19
    40.     If i < 19 Then
    41.         Printer.Print Label8(i).Caption;
    42.         Printer.CurrentX = Printer.CurrentX + 1150 - (Label8(i + 1).Width / 2)
    43.         Printer.CurrentY = 10800
    44.     Else: Printer.CurrentX = 900 + Picture1.Width - (Label8(19).Width / 3)
    45.         Printer.Print Label8(19).Caption
    46.     End If
    47. Next
    48.  
    49. Printer.EndDoc
    50.  
    51. 'Picture2.Visible = False
    52.  
    53. End Function

    So I guess my question is, can I call that function from inside the Print dialog?
    Place Your VBForums Ad Here

  2. #2
    Hyperactive Member
    Join Date
    May 2002
    Location
    Omaha, NE
    Posts
    263

    Maybe this will help you...

    ...instead of using the Common Dialog, try using the actual Printer Settings Dialog. I don't know if this helps at all, but maybe.

    http://support.microsoft.com/default...b;en-us;322710

  3. #3

    Thread Starter
    Addicted Member run_GMoney's Avatar
    Join Date
    May 2002
    Location
    Detroit
    Posts
    186
    Outstanding. That should work. I'll post my code when I get all the bugs worked out. Thanks for that link.
    Place Your VBForums Ad Here

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