Screen Capture Demo : Screen Capture « GUI « VB.Net

Home
VB.Net
1.2D
2.Application
3.Class
4.Data Structure
5.Data Types
6.Database ADO.net
7.Development
8.Event
9.File Directory
10.Generics
11.GUI
12.Language Basics
13.LINQ
14.Network Remote
15.Security
16.Thread
17.Windows Presentation Foundation
18.Windows System
19.XML
20.XML LINQ
VB.Net Tutorial
VB.Net by API
VB.Net » GUI » Screen CaptureScreenshots 
Screen Capture Demo
  
Imports System.Windows.Forms
Imports System.Drawing
Public Class Form1
    Inherits System.Windows.Forms.Form
    Public Sub New()
        MyBase.New()
        InitializeComponent()
    End Sub
    Friend WithEvents PictureBox1 As System.Windows.Forms.PictureBox
    Friend WithEvents Button1 As System.Windows.Forms.Button
    <System.Diagnostics.DebuggerStepThrough()Private Sub InitializeComponent()
        Me.PictureBox1 = New System.Windows.Forms.PictureBox()
        Me.Button1 = New System.Windows.Forms.Button()
        Me.SuspendLayout()
        '
        Me.PictureBox1.Location = New System.Drawing.Point(28816)
        Me.PictureBox1.Size = New System.Drawing.Size(192136)
        Me.PictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.StretchImage
        '
        Me.Button1.Location = New System.Drawing.Point(3240)
        Me.Button1.Size = New System.Drawing.Size(20840)
        Me.Button1.Text = "Capture the Screen"
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(513)
        Me.ClientSize = New System.Drawing.Size(496166)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.Button1, Me.PictureBox1})
        Me.Text = "Capturing the Screen, Quick and Easy"
        Me.ResumeLayout(False)

    End Sub
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgsHandles Button1.Click
        GetScreenCapture(True).Save("c:\screengrab.bmp")
        PictureBox1.Image = GetScreenCapture()
    End Sub

    Public Function GetScreenCapture_
        Optional ByVal FullScreen As Boolean = FalseAs Image
        Dim objSK As SendKeys
        Dim imgCapture As Image
        If FullScreen = True Then
            objSK.SendWait("{PRTSC 2}")
        Else
            objSK.SendWait("%{PRTSC}")
        End If
        Dim objData As IDataObject = Clipboard.GetDataObject()
        Return objData.GetData(DataFormats.Bitmap)
    End Function

End Class

   
    
  
Related examples in the same category
1.Screen snapshot
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.