Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. Print the form

Print the form

Scheduled Pinned Locked Moved Visual Basic
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ajay58886
    wrote on last edited by
    #1

    Hi to All, i want to print out the perticuler form. plz tell me about code of print the perticuler form thru printer.... thanking you...

    Impact Pro

    A 1 Reply Last reply
    0
    • A ajay58886

      Hi to All, i want to print out the perticuler form. plz tell me about code of print the perticuler form thru printer.... thanking you...

      Impact Pro

      A Offline
      A Offline
      Ajay k_Singh
      wrote on last edited by
      #2

      Hello, You may take a snapshot of Form using PrintToBitmap function of Form. Following is a code snippet to do so- bmp = New Bitmap(Me.ClientRectangle.Width, Me.ClientRectangle.Height) Me.DrawToBitmap(bmp, New Rectangle(Me.ClientRectangle.X, Me.ClientRectangle.Y, Me.ClientRectangle.Width, Me.ClientRectangle.Height)) Me.PictureBox2.Image = bmp If you want to print this data then you will need to add one PrintDocument object, like this- Dim WithEvents pdoc As New System.Drawing.Printing.PrintDocument Add code in PrintPage Event of PrintDocument object something like – e.Graphics.DrawImage(bmp, Me.ClientRectangle.X, Me.ClientRectangle.Y) Then you may get it printed by simply using a line of code- pdoc.Print() This would print the picture of the form. I hope this helps:). -Dave.

      Dave Traister, ComponentOne LLC. www.componentone.com

      A 1 Reply Last reply
      0
      • A Ajay k_Singh

        Hello, You may take a snapshot of Form using PrintToBitmap function of Form. Following is a code snippet to do so- bmp = New Bitmap(Me.ClientRectangle.Width, Me.ClientRectangle.Height) Me.DrawToBitmap(bmp, New Rectangle(Me.ClientRectangle.X, Me.ClientRectangle.Y, Me.ClientRectangle.Width, Me.ClientRectangle.Height)) Me.PictureBox2.Image = bmp If you want to print this data then you will need to add one PrintDocument object, like this- Dim WithEvents pdoc As New System.Drawing.Printing.PrintDocument Add code in PrintPage Event of PrintDocument object something like – e.Graphics.DrawImage(bmp, Me.ClientRectangle.X, Me.ClientRectangle.Y) Then you may get it printed by simply using a line of code- pdoc.Print() This would print the picture of the form. I hope this helps:). -Dave.

        Dave Traister, ComponentOne LLC. www.componentone.com

        A Offline
        A Offline
        ajay58886
        wrote on last edited by
        #3

        Hi, Thanks for reply. i try this function. ok. have a good day.....

        Impact Pro

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups