9 Mart 2014 Pazar
EKRAN YAKALAMA PROJE ÖRNEĞİ
EKRAN YAKALAMA PROJE KODLARI
İNDİR
Imports System.Runtime.InteropServices Public Class Form1 Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Dim kenarlar As Rectangle Dim EkranGorunumu As System.Drawing.Bitmap Dim Grafik As Graphics kenarlar = Screen.PrimaryScreen.Bounds EkranGorunumu = New System.Drawing.Bitmap(kenarlar.Width, kenarlar.Height, System.Drawing.Imaging.PixelFormat.Format32bppArgb) Grafik = Graphics.FromImage(EkranGorunumu) Grafik.CopyFromScreen(kenarlar.X, kenarlar.Y, 0, 0, kenarlar.Size, CopyPixelOperation.SourceCopy) PictureBox1.Image = EkranGorunumu Timer1.Enabled = False Me.Opacity = 100 End Sub Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick Timer.Stop() If PictureBox1.Image IsNot Nothing Then PictureBox1.Image.Dispose() PictureBox1.SizeMode = PictureBoxSizeMode.Zoom PictureBox1.Image = PencereGorunumuYakala() Me.Show() End Sub Private Sub YakalaMn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles YakalaMn.Click Me.Opacity = 0 Timer1.Enabled = True SaklaMn.Enabled = True DonderTs.Enabled = True End Sub Private Sub SaklaMn_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaklaMn.Click, DsySaklaTs.Click Dim DsySaklaDlg As New SaveFileDialog Try DsySaklaDlg.Title = "Dosya Sakla" DsySaklaDlg.FileName = "Yakalanan" DsySaklaDlg.Filter = "Bitmap (*.bmp;*.dib)|*.bmp;*.dib|JPEG (*.jpg;*.jpeg;*.jpe;*.jfif)|*.jpg;*.jpeg;*.jpe;*.jfif|GIF (*.gif)|*.gif|TIFF (*.tif;*.tiff)|*.tif;*.tiff|PNG (*.png)|*.png" If DsySaklaDlg.ShowDialog() = DialogResult.OK Then PictureBox1.Image.Save(DsySaklaDlg.FileName, System.Drawing.Imaging.ImageFormat.Bmp) End If Catch ex As Exception MsgBox(ex.Message()) End Try End Sub Private Sub DonderTs_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DonderTs.Click On Error Resume Next If PictureBox1 IsNot Nothing Then PictureBox1.Image.RotateFlip(RotateFlipType.Rotate90FlipNone) PictureBox1.Refresh() End If End Sub Private WithEvents Timer As New Timer With {.Interval = 100}
_ Private Shared Function GetWindowRect(ByVal hWnd As System.IntPtr, ByRef lpRect As RECT) As
Boolean End Function
_ Private Shared Function GetForegroundWindow() As System.IntPtr End Function
_ Private Structure RECT Public left As Integer Public top As Integer Public right As Integer Public bottom As Integer End Structure Private Function PencereGorunumuYakala() As Image Dim bmp As Bitmap = Nothing Dim hWnd As IntPtr = GetForegroundWindow() If Not hWnd.Equals(IntPtr.Zero) Then Dim kaydet As New RECT GetWindowRect(hWnd, kaydet) Dim recSize As New Size(kaydet.right - kaydet.left, kaydet.bottom - kaydet.top) bmp = New Bitmap(recSize.Width, recSize.Height) Dim Grfk As Graphics = Graphics.FromImage(bmp) Grfk.CopyFromScreen(kaydet.left, kaydet.top, 0, 0, recSize, CopyPixelOperation.SourceCopy) Grfk.Dispose() PictureBox1.Image = bmp Timer2.Enabled = False Me.Opacity = 100 End If Return bmp End Function Private Sub TamEkranTs_Click(sender As System.Object, e As System.EventArgs) Handles TamEkranTs.Click Me.WindowState = FormWindowState.Maximized End Sub Private Sub MinimizeEkranTs_Click(sender As System.Object, e As System.EventArgs) Handles MinimizeEkranTs.Click Me.WindowState = FormWindowState.Minimized End Sub Private Sub NormalEkranTs_Click(sender As System.Object, e As System.EventArgs) Handles NormalEkranTs.Click Me.WindowState = FormWindowState.Normal End Sub Private Sub DsyAcTs_Click(sender As System.Object, e As System.EventArgs) Handles DsyAcTs.Click Dim AcDlg = OpenFileDialog1 Dim pic = PictureBox1 AcDlg.Filter = "Bitmap (*.bmp;*.dib)|*.bmp;*.dib|JPEG (*.jpg;*.jpeg;*.jpe;*.jfif)|*.jpg;*.jpeg;*.jpe;*.jfif|GIF (*.gif)|*.gif|TIFF (*.tif;*.tiff)|*.tif;*.tiff|PNG (*.png)|*.png" If AcDlg.ShowDialog = Windows.Forms.DialogResult.OK Then pic.Image = Image.FromFile(AcDlg.FileName) DonderTs.Enabled = True End If End Sub Private Sub TamEkranYakalaTs_Click(sender As System.Object, e As System.EventArgs) Handles TamEkranYakalaTs.Click Me.Opacity = 0 Timer1.Enabled = True SaklaMn.Enabled = True End Sub Private Sub AktifpenYakalaTs_Click(sender As System.Object, e As System.EventArgs) Handles AktifpenYakalaTs.Click Me.Opacity = 0 Timer2.Enabled = True SaklaMn.Enabled = True Me.Hide() Timer.Start() End Sub Private Sub CikTs_Click(sender As System.Object, e As System.EventArgs) Handles CikTs.Click If MsgBox("Çıkmak İstiyor musunuz ?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then Me.Close() End If End Sub Private Sub ToolStripButton1_Click(sender As System.Object, e As System.EventArgs) Handles ResimSilTs.Click PictureBox1.Image = Nothing End Sub Private Sub NotifyIcon1_MouseClick(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseClick If Me.WindowState = FormWindowState.Normal Then Me.Hide() Me.Top = 4000 Me.WindowState = FormWindowState.Minimized Else Me.Top = 180 Me.StartPosition = FormStartPosition.CenterScreen Me.WindowState = FormWindowState.Normal Me.Show() End If End Sub Private Sub NotifyIcon1_MouseDown(sender As System.Object, e As System.Windows.Forms.MouseEventArgs) Handles NotifyIcon1.MouseDown If e.Button = Windows.Forms.MouseButtons.Right Then Me.NotifyIcon1.Dispose() End End If End Sub End Class
Hiç yorum yok:
Yorum Gönder
Sonraki Kayıt
Önceki Kayıt
Ana Sayfa
Kaydol:
Kayıt Yorumları (Atom)
Hiç yorum yok:
Yorum Gönder