Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hello, is there any way to call the printpreviewdialogs code? or below you can see basically what i need to do. I just cant pass the system.drawing.printing.printPageEventArgs reference. I need to pass it on to be able to call it. Any suggestions?

 

PrintDocument1_printpage(Me, Printing.PrintPageEventArgs)

 

The reason i ask is that im trying to print a picture and i can get the printer to print but i just cant get it to drawImage.

 

Cheers

Chris
Posted (edited)

Hi wildfire,

 

this is some code of mine (excerpt) I hope this helps a little bit:

 

Protected oPrintPreDlg as New PrintPreviewDialog
Protected oProntDoc as New PrintDocument

...

oPrintPreDlg.Document = oPrintDoc 'What to print in printpreview
oPrintPreDlg.ShowDialog()
'oPrintDoc.Print() 'Would print the document to the printer
...

Private Sub oPrintDoc_Printpage(sender as Object, e as system.drawing.PrintEventargs)...
...
e.Graphics.DrawLine(...)
e.Graphics.DrawString("SomeText",...)
...
End Sub

 

You just need to define your printdocument-object. Printpage is the Event where you can define what to print. You do not need to define any PrintPageEventArgs or something like that. In the example I'd just draw a line and some text. There are also Methods for drawing images or whatever you want.

 

Any further questions, just ask

 

Voca

Edited by Voca

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...