Results 1 to 8 of 8

Thread: printing the form

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Location
    MN
    Posts
    362

    printing the form

    How can I print the entire form? (to the printer)

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    VB Code:
    1. Private Sub Command1_Click()
    2.     Me.PrintForm
    3. End Sub
    -= a peet post =-

  3. #3
    Member BinaryAnge's Avatar
    Join Date
    Jun 2002
    Location
    Columbus,Ohio
    Posts
    51
    Private Sub PrintButton_Click()
    PrintForm
    End Sub
    The Programmers Credo -
    Protect dumb-ass from himself.

  4. #4

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Location
    MN
    Posts
    362
    ok, works sorta, exept.....
    my pie chart, which shows up in a pic box, prints to the upper right. how can i force the pie chart to print to the upper right?

  5. #5

    Thread Starter
    Hyperactive Member
    Join Date
    May 2001
    Location
    MN
    Posts
    362
    ok, works sorta, exept.....
    my pie chart, which shows up in a pic box, prints to the upper right. how can i force the pie chart to print to the upper right?

  6. #6
    Fanatic Member
    Join Date
    Jun 2001
    Location
    Baltimore,MD
    Posts
    536
    me.printform is good but if you want the user to be able to print more than one copy without having to incessantly press print then use the commondialog.showprinter here is the code that you would use
    [Highlight=VB]
    Dim BeginPage, EndPage, NumCopies, Orientation, i
    CommonDialog1.CancelError = True
    On Error GoTo errhandler
    CommonDialog1.ShowPrinter
    BeginPage = CommonDialog1.FromPage
    EndPage = CommonDialog1.ToPage
    NumCopies = CommonDialog1.Copies
    Orientation = CommonDialog1.Orientation
    For i = 1 To NumCopies
    Next
    me.printform
    printer.enddoc
    [\vbcode]
    Walter Richardson
    Striver2000 Christian Productions
    Iam seventeen but since I started VB in June of 01 GOD has been helping me excell by finding this great forum with a bunch of GREAT PEOPLE!

  7. #7
    Megatron
    Guest
    Originally posted by meopilite
    ok, works sorta, exept.....
    my pie chart, which shows up in a pic box, prints to the upper right. how can i force the pie chart to print to the upper right?

  8. #8
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Try this

    VB Code:
    1. Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    2. Private Const VK_MENU As Byte = &H12
    3. Private Const VK_SNAPSHOT As Byte = &H2C
    4. Private Const KEYEVENTF_KEYUP = &H2
    5.  
    6. Private Sub cmdPrintForm_Click()
    7. Dim lWidth As Long, lHeight As Long
    8.     Clipboard.Clear
    9.     Call keybd_event(VK_MENU, 0, 0, 0)
    10.     Call keybd_event(VK_SNAPSHOT, 0, 0, 0)
    11.     DoEvents
    12.     Call keybd_event(VK_SNAPSHOT, 0, KEYEVENTF_KEYUP, 0)
    13.     Call keybd_event(VK_MENU, 0, KEYEVENTF_KEYUP, 0)
    14.     Printer.Print
    15.     If Width > Printer.ScaleWidth Then
    16.         lWidth = Printer.ScaleWidth
    17.         lHeight = (Printer.ScaleWidth / Width) * Height
    18.     Else
    19.         lWidth = Width
    20.         lHeight = Height
    21.     End If
    22.     Printer.PaintPicture Clipboard.GetData, 0, 0, lWidth, lHeight
    23.     Printer.EndDoc
    24. End Sub

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