sábado, 18 de agosto de 2012

on


Public Class Form1

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

        Try
            If chkTelaCheia.Checked Then
                capturaTela(True).Save("c:\tela1.bmp")
                PictureBox1.Image = capturaTela()
            Else
                capturaTela(False).Save("c:\tela1.bmp")
                PictureBox1.Image = capturaTela()
            End If

        Catch ex As Exception

        End Try

    End Sub

    Public Function capturaTela(Optional ByVal TelaCheia As Boolean = False) As Image
        Dim objTela As Image
        Dim objEnviaTecla As SendKeys

        If TelaCheia Then
            objEnviaTecla.SendWait("{PRTSC 2}")
        Else
            objEnviaTecla.SendWait("%{PRTSC}")
        End If

        Dim objData As IDataObject = Clipboard.GetDataObject
        Return objData.GetData(DataFormats.Bitmap)

    End Function

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        PictureBox1.Image() = Nothing
    End Sub
End Class


Até mais... Abraços!

0 comentários:

Postar um comentário