可能重复:
VB.NET 替换图片框图像的像素颜色
我想从全图
全图中提取正方形:
我只想要这个:
使用此功能应该可以工作:
Public Function GetPicturePart(ByVal SourceImage As Image, ByVal Region As Rectangle) As Bitmap
Dim ImagePart As Bitmap = New Bitmap(Region.Width, Region.Height)
Using G As Graphics = Graphics.FromImage(ImagePart)
Dim TargetRect As Rectangle = New Rectangle(0, 0, Region.Width, Region.Height)
Dim SourceRect As Rectangle = Region
G.DrawImage(SourceImage, TargetRect, SourceRect, GraphicsUnit.Pixel)
End Using
Return ImagePart
End Function
我认为这个功能是自描述的。;)
来源:获取图片部分