vb.net怎实现只绘图图的一部份
1个回答
展开全部
'如通过Clone 获取图的一部分为一新图,
Dim img As Bitmap = My.Resources._201507090931512961_4758611
Dim unit As GraphicsUnit ' = GraphicsUnit.Pixel
Dim r = img.GetBounds(unit)
r.Inflate(-r.Width \ 4, -r.Height \ 4)
Dim newImg As Bitmap = img.Clone(r, img.PixelFormat)
PictureBox1.Image=newImg
'在paint事件中DrawImage方法也可以实现的
Private Sub PictureBox1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles PictureBox1.Paint
Dim img As Bitmap = My.Resources._201507090931512961_4758611
Dim unit As GraphicsUnit ' = GraphicsUnit.Pixel
Dim r = img.GetBounds(unit)
r.Inflate(-r.Width \ 4, -r.Height \ 4)
e.Graphics .DrawImage(img, 0, 0, r, unit)
End Sub
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询