Jump to content

[vb.2005]Imprimir form


esquima

Recommended Posts

depende, tipo é para uma coisa pessoal ou para divulgares ao people? eu, se fosse um programa para uso pessoal e que fosse compativel com este metodo, fazia:

um sendkeys para a tecla de printscreen, abria o paint atraves do ShellEx, fazia ctrl+v, fazia o atalho para guardar, fazia um sendkeys para o nome + um enter para guardar, e depois um sendkeys para fechar o paint... 🙂

Link to comment
Share on other sites

ah, pois, isso é mais complicado 🙂

encontrei uma coisa pode ser que te ajude... talvez 🙂

    Const SRCCOPY As Integer = &HCC0020
    Public Function BitBlt(ByVal hdcDest As IntPtr, ByVal nXDest As Integer, ByVal nYDest As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hdcSrc As IntPtr, ByVal nXSrc As Integer, ByVal nYSrc As Integer, ByVal dwRop As Integer) As Integer
    End Function

    Private Sub mniPrintScreen_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles mniPrintScreen.Click
        Snapshot("\save.bmp", Me.CreateGraphics, Me.btnModule1A.Bounds)
    End Sub

    Private Sub Snapshot(ByVal filename As String, ByVal gx As Graphics, ByVal rect As Rectangle)
        Try
            ' Create compatible graphics
            Dim bmp As Bitmap = New Bitmap(rect.Width, rect.Height)
            Dim gxComp As Graphics = Graphics.FromImage(bmp)

            ' Blit the image data
            BitBlt(gxComp.GetHdc(), 0, 0, rect.Width, rect.Height, gx.GetHdc(), rect.Left, rect.Top, SRCCOPY)
            bmp.Save(filename, System.Drawing.Imaging.ImageFormat.Bmp)

            ' Cleanup
            bmp.Dispose()
            gxComp.Dispose()
        Catch ex As Exception
            MessageBox.Show(ex.Message, "ERROR", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1)
        End Try
    End Sub
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site you accept our Terms of Use and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.