Screenshoter - 簡易截圖程式 VB.net
這是Google來的~改了一小部分...
我其實很久以前就看過有人寫這樣的東東~只是不知道丟哪去了...
其實是在寫程式的時候一直切換視窗很煩就想說拍下來比較快XD
一個 Form 一個 PictureBox 足以~
複製代碼
我其實很久以前就看過有人寫這樣的東東~只是不知道丟哪去了...
其實是在寫程式的時候一直切換視窗很煩就想說拍下來比較快XD
一個 Form 一個 PictureBox 足以~
- Public Class Form1
- Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click '點擊執行
- Opacity = 0 '視窗透明(不然會照到自己)
- Dim ScrnPB As PictureBox = PictureBox1
- Dim ScrnSize As Size = My.Computer.Screen.Bounds.Size
- Dim ScrnImage As New Bitmap(ScrnSize.Width, ScrnSize.Height)
- Dim g As Graphics = Graphics.FromImage(ScrnImage)
- g.CopyFromScreen(New Point(Me.Left + 8, Me.Top + 30), New Point(0, 0), ScrnSize) '以自己視窗為始點修正偏移
- Dim dc As IntPtr = g.GetHdc
- g.ReleaseHdc(dc)
- With ScrnPB '使大小相同
- .Size = ScrnSize
- .Image = ScrnImage
- End With
- Opacity = 70 '視窗透明度70%
- End Sub
- End Class
留言
張貼留言