怎样做到messagebox不覆盖picturebox的内容?
Dim oldpt As New Point(100, 100)
Dim newpt As New Point(500, 100)
Public Cache As New Bitmap(500, 500)
Public CacheG As Graphics
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
DrawImage()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
MessageBox.Show("The calculations are complete", "msg", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
End Sub
Private Function DrawImage()
PictureBox1.CreateGraphics.DrawLine(New Pen(Color.Black, 1), oldpt, newpt)
End Function
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
DrawImage()
End Sub
以上是我按照这个论坛里一篇帖子里抄来的,Button1_Click在PictureBox1里画一条直线,Button2_Click弹出 messagebox。虽然我发现在移动messagebox时候没有问题,但是如果最后点击OK的时候如果messagebox还在直线上,那么messagebox消失以后,直线被遮盖的部份也随着消失了。