반응형

* VBNET 화면 캡쳐 (Screen Capture) 예제...

 

 

Main

 

 

-사용한 컨트롤: Button 2개, PictureBox 1개

 

전체 소스 코드

Form1.vb

 

Public Class Form1
    Dim btMain As Bitmap

    Private Sub btTSC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btTSC.Click

        'Total Screen Capture
        btMain = New Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height)

        Using g As Graphics = Graphics.FromImage(btMain)
            g.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, _
                             Screen.PrimaryScreen.Bounds.Y, _
                             0, 0, _
                             btMain.Size, _
                            CopyPixelOperation.SourceCopy)
            'Picture Box Display
            pbMain.Image = btMain

        End Using

    End Sub

    Private Sub btFilesave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btFilesave.Click

        'File Save
        If Not btMain Is Nothing Then
            Dim sfd As SaveFileDialog = New SaveFileDialog()

            sfd.Filter = "JPG File(*.jpg) | *.jpg"

            If sfd.ShowDialog() = DialogResult.OK Then
                btMain.Save(sfd.FileName)
            End If

        End If

    End Sub

End Class

 

 

*예제 결과

 

- 전체 화면 캡쳐한 모습

 

 

-파일로 저장하는 모습

 

 

 

https://kdsoft-zeros.tistory.com/185

 

[C#] 화면 캡쳐 (Screen Capture)

* C# 화면 캡쳐 (Screen Capture) 예제... -사용한 컨트롤: Button 2개, PictureBox 1개 전체 소스 코드 Form1.cs using System; using System.Collections.Generic; using System.ComponentModel; using System...

kdsoft-zeros.tistory.com

 

반응형

+ Recent posts