我在 PictureBox 中加载了一个图像 (800x800p)。它具有轻微的交互性,单击它的某处将显示工具提示或弹出窗口。
有时,单击会导致在单击位置上添加 100x100 像素的图像。该修改需要保存到主图像上。
关于如何做到这一点的任何想法?
在原始图像上绘制新图像。例如:
Public Class Form1
Private Sub PictureBox1_Click(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseClick
Dim NewIMG As New Bitmap(100, 100)
Graphics.FromImage(NewIMG).Clear(Color.Black) 'just to make my image black since I don't have any image
'You drawing new image here
Graphics.FromImage(PictureBox1.Image).DrawImage(NewIMG, New Point(e.X - 50, e.Y - 50)) 'mouse position - half new image size so that new image center is placed at cursor location
PictureBox1.Refresh() 'to make picbox redraw and display new image
End Sub
End Class
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句