반응형
* VBNET 화면 캡쳐 (Screen Capture) 예제...
-사용한 컨트롤: 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
반응형
'VB.NET Programming' 카테고리의 다른 글
[VBNET] SendKeys - 화면 캡쳐 (Screen Capture) (0) | 2020.04.16 |
---|---|
[VBNET] 선택된 프로세스 죽이기 (Kill Process) (0) | 2020.04.14 |
[VBNET] [Control] WebBrowser 컨트롤 - 외부 IP 알아내기 (0) | 2020.04.08 |
[VBNET] [WMI] USB Detect 예제 (0) | 2020.04.06 |
[VBNET] [WMI] CPU 클럭 속도 (CurrentClockSpeed) (0) | 2020.04.02 |