您好,登錄后才能下訂單哦!
這篇文章主要講解了“VB.NET遠程控制抓屏+壓縮的實現方法”,文中的講解內容簡單清晰,易于學習與理解,下面請大家跟著小編的思路慢慢深入,一起來研究和學習“VB.NET遠程控制抓屏+壓縮的實現方法”吧!
VB.NET經過長時間的發展,很多用戶都很了解VB.NET遠程控制了,我把我的一點點這方面的經驗和大家分享一下。VB.NET做為VB6的升級版本,具備了許多新的功能,它可以簡便快捷地創建 .NET 應用程序(包括 XML Web services 和 ASP.NET Web 應用程序),還是一個功能強大的面向對象的編程語言(如繼承、接口和重載)。
新的語言功能包括自由線程處理和結構化異常處理。VB.NET 還完全集成了.NET 框架和公共語言運行庫,.NET 框架和公共語言運行庫共同提供語言互操作性、垃圾回收、增強的安全性和改進的版本支持。可以說是一個劃時代的產品!我們來看看VB.NET遠程控制實例[抓屏+壓縮]的小例子。
VB.NET遠程控制轉化后代碼如下:
Imports System
Imports System.Text
Imports System.Drawing.Imaging
Imports System.IO
Imports System.Drawing
Imports System.Windows.Forms
Namespace Lob.Windows
Public Class ScreenCapture
Private Declare Function BitBlt Lib "GDI32" (ByVal hdcDest As IntPtr, ByVal nXDest As Integer, ByVal nYDest As Integer,
ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hdcSrc As IntPtr, ByVal nXSrc As Integer, ByVal nYSrc As Integer,
ByVal dwRop As Integer) As Boolean
Private Declare Function CreateDC Lib "GDI32" (ByVal lpszDriver As String, ByVal lpszDevice As String,
ByVal lpszOutput As String, ByVal lpInitData As IntPtr) As IntPtr
Public Shared Function Capture() As Image
Dim dc1 As IntPtr = CreateDC("DISPLAY", Nothing, Nothing, CType(Nothing, IntPtr))
Dim g1 As GraphicsGraphics = Graphics.FromHdc(dc1)
Dim ScreenImage As Bitmap = New Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, g1)
Dim g2 As GraphicsGraphics = Graphics.FromImage(ScreenImage)
Dim dc3 As IntPtr = g1.GetHdc
Dim dc2 As IntPtr = g2.GetHdc
BitBlt(dc2, 0, 0, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, dc3, 0, 0, 13369376)
g1.ReleaseHdc(dc3)
g2.ReleaseHdc(dc2)
Dim bmp As Image = MakeThumbnail(ScreenImage, (ScreenImage.Width * (3 / 4)), (ScreenImage.Height * (3 / 4)))
Return bmp
End Function
Public Shared Function MakeThumbnail(ByVal originalImage As Image, ByVal towidth As Integer, ByVal toheight As Integer) As Image
Dim x As Integer = 0
Dim y As Integer = 0
Dim ow As Integer = originalImage.Width
Dim oh As Integer = originalImage.Height
Dim bitmap As System.Drawing.Image = New System.Drawing.Bitmap(towidth, toheight)
Dim g As SystemSystem.Drawing.Graphics = System.Drawing.Graphics.FromImage(bitmap)
g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.High
g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighSpeed
g.Clear(System.Drawing.Color.Transparent)
g.DrawImage(originalImage, New System.Drawing.Rectangle(0, 0, towidth, toheight), New System.Drawing.Rectangle(x, y, ow, oh),
System.Drawing.GraphicsUnit.Pixel)Return bitmap
End Function
End Class
End Namespace
感謝各位的閱讀,以上就是“VB.NET遠程控制抓屏+壓縮的實現方法”的內容了,經過本文的學習后,相信大家對VB.NET遠程控制抓屏+壓縮的實現方法這一問題有了更深刻的體會,具體使用情況還需要大家實踐驗證。這里是億速云,小編將為大家推送更多相關知識點的文章,歡迎關注!
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。