Printing areas of a form and increasing the size

I have an order form that I would like to print out on A size paper but the PrintForm only uses a small area of the page. How can I enlarge the mage to fill the whole page. Also is it possible to print only a part of a form.

Thanks



Answer this question

Printing areas of a form and increasing the size

  • RenoMike

    Hi Sassie,

    The PrintForm component will only print the actual size of the form. If I'm misunderstanding the problem please feel free to contact me directly at JohnHart@Microsoft.com and I'll be glad to see if I can help.

    Do you have a great idea for a new Power Pack Let us know what you want to see us develop to help make Visual Basic 2005 event better by going to http://connect.Microsoft.com/vbasic

    Thanks



  • Divyajosephjohn

    No this does not solve my problem. The result I get is the same but with a black area underneath the form I have a screen print but I can't paste it in here! Is there anyway of sending to you so youcan see my problem


  • bes7252

    Hi, you can email me using the email from my profile

    I do not know about enlarging. To avoid black areas I used form.Show() before printing the form.

    About printing part of the form you can use few possibilities.

    First you can define the client area that you want to print (the example is from John's response to my question)

    Sub PrintForm()


    'Set the client Size acording to needable size
    Dim tSize As New Size(Me.ClientSize.Width, Me.ClientSize.Height)
    Dim intWidth As Integer = 780
    Dim intHeight As Integer = your size for print
    Me.ClientSize = New Size(intWidth, intHeight)

    PrintForm1.Print(Me, PowerPacks.Printing.PrintForm.PrintOption.ClientAreaOnly)


    'set everything back the way it was
    Me.ClientSize = tSize

    End Sub

    Second you can put the information to print on the special panel on you form and then create temporary form. Add this panel to the Controls of the temporary form and print this form. Do not forget to put the panel back. Something like this:

    //create temporay form

    Form FormForPrint = new Form();

    FormForPrint.Show();

    //add panel from your form to temporary form

    FormForPrint.Controls.Add(pnlForPrint);

    PrintForm1.Form = FormForPrint

    PrintForm1.Print();

    //Hide or Close temporary form

    FormForPrint.Hide() or Close() //according to your needs

    //return the panel for print back to the main form

    this.Controls.Add(pnlForPrint)

    Hope it will help


  • Tryin2Bgood

    Please look to Scrollable option problem thread.

    May be it can be helpful for you


  • Printing areas of a form and increasing the size