nectarios777
asked on
Print Screen function
Hello all,
I would like to print screen of my pc.
I would like to click a button and save this into my c:\images\
Could anyone please send me the code for this?
I am using vb.net
Thanks
I would like to print screen of my pc.
I would like to click a button and save this into my c:\images\
Could anyone please send me the code for this?
I am using vb.net
Thanks
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Hi,
You can add this if you want to: (the first sub was already referred to in my first post)
Public Sub PreviewData()
' Prepare and show data
Me.Focus()
myScreenshot = GetScreenSnapshot(True)
Me.Visible = False
dlgPrintPreview.Document = PreparePrintDocument()
dlgPrintPreview.ShowDialog ()
Me.Visible = True
End Sub
Private Sub Print_PrintPage(ByVal sender As Object, ByVal e As PrintPageEventArgs)
On Error GoTo 0
Dim margins As New Margins(50, 50, 50, 50)
PrintDocument1.PrinterSett ings.Defau ltPageSett ings.Lands cape = True
PrintDocument1.DefaultPage Settings.M argins = margins
e.Graphics.DrawImage(myScr eenshot, 30, 30, PrintDocument1.DefaultPage Settings.P aperSize.W idth - 60, PrintDocument1.DefaultPage Settings.P aperSize.H eight - 650)
e.HasMorePages = False
End Sub
You can add this if you want to: (the first sub was already referred to in my first post)
Public Sub PreviewData()
' Prepare and show data
Me.Focus()
myScreenshot = GetScreenSnapshot(True)
Me.Visible = False
dlgPrintPreview.Document = PreparePrintDocument()
dlgPrintPreview.ShowDialog
Me.Visible = True
End Sub
Private Sub Print_PrintPage(ByVal sender As Object, ByVal e As PrintPageEventArgs)
On Error GoTo 0
Dim margins As New Margins(50, 50, 50, 50)
PrintDocument1.PrinterSett
PrintDocument1.DefaultPage
e.Graphics.DrawImage(myScr
e.HasMorePages = False
End Sub
bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
Private Const VK_SNAPSHOT = &H2C
Public Sub PrintScreen()
keybd_event VK_SNAPSHOT, 1, 0, 0
End Sub