Private Function GetBitmap(ByVal bmp As Image, ByVal row As Integer, ByVal col As Integer) As Bitmap
Dim bp As New Bitmap(48, 48)
Dim g As Graphics = Graphics.FromImage(bp)
g.DrawImage(bmp, -(col - 1) * 48, -(row - 1) * 48)
g.Dispose()
'bp.MakeTransparent(Color.FromArgb(0, 136, 176, 182))
Return bp
End Function
Private Sub Button1_Click_1(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim a As New Bitmap("d:\showimg.jpg")
'第2行,第一列
Me.PictureBox1.Image = GetBitmap(a, 2, 1)
a.Dispose()
End Sub
对VB.net感兴趣的请加入15636854讨论群