VB 2005
Imports
System.Runtime.InteropServices
Public Function GetControlBitmap() Function GetControlBitmap(ByVal c As Control, ByVal targetBounds As Rectangle) As Drawing.Bitmap
If (((targetBounds.Width <= 0) OrElse (targetBounds.Height <= 0)) OrElse ((targetBounds.X < 0) OrElse (targetBounds.Y < 0))) Then
Throw New ArgumentException("目标大小错误")
End If
Dim width As Integer = Math.Min(c.Width, targetBounds.Width)
Dim height As Integer = Math.Min(c.Height, targetBounds.Height)
Dim image As New Bitmap(width, height)
Dim bmp As New Bitmap(width, height)
Public Function GetControlBitmap() Function GetControlBitmap(ByVal c As Control, ByVal targetBounds As Rectangle) As Drawing.Bitmap
If (((targetBounds.Width <= 0) OrElse (targetBounds.Height <= 0)) OrElse ((targetBounds.X < 0) OrElse (targetBounds.Y < 0))) Then
Throw New ArgumentException("目标大小错误")
End If
Dim width As Integer = Math.Min(c.Width, targetBounds.Width)
Dim height As Integer = Math.Min(c.Height, targetBounds.Height)
Dim image As New Bitmap(width, height)
Dim bmp As New Bitmap(width, height)