各位大虾帮帮忙,小弟碰到一个刺手的问题,在form上放了一个panel,再在panel里面放了一个picturebox控件,代码如下所示
Dim sourceBitmap, destBitmap As Bitmap
dim destGraphicContext As Graphics
Private screenImageWidth_mulcontext As Integer = 0
Private screenImageHeight_mulcontext As Integer = 0'--------------以下是from_load-----------------
sourceBitmap = New Bitmap(originalImage)'originalImage是原始的bmp格式文件
destBitmap = New Bitmap(CInt(sourceBitmap.Width * factor), CInt(sourceBitmap.Height * factor)) 'Factor是放大倍数
            picbox.Image = destBitmap
            screenImageWidth_mulcontext = destBitmap.Width
            screenImageHeight_mulcontext = destBitmap.Height
            destGraphicContext = Graphics.FromImage(destBitmap)   
            destGraphicContext.DrawImage(sourceBitmap, 0, 0, destBitmap.Width, destBitmap.Height)
----------------------------------------------------
以下是画线段的function
Private Sub LocatePoint(ByRef mulDisplay As PictureBox, ByVal lngX As Long, ByVal lngY As Long)
        
        mulDisplay.Refresh()
'           第一种方法代码是:每次调用这个function时,都要重画destGraphicContext.DrawImage这个影响速度,但可以清除之前的线段
              destGraphicContext.DrawImage(mulcontextsourceBitmap, 0, 0, mulcontextdestBitmap.Width, mulcontextdestBitmap.Height)
            destGraphicContext.DrawLine(Pens.Yellow, lngX, 0, lngX, screenImageHeight_mulcontext) 
            destGraphicContext.DrawLine(Pens.Yellow, 0, lngY, screenImageWidth_mulcontext, lngY)'第二种方法代码速度快,也能清除线段,但有个问题是,当我开启一个新窗体在所画的线段上面拖时,会把线段擦除,
            mulDisplay.CreateGraphics.DrawLine(Pens.Yellow, lngX, 0, lngX, screenImageHeight_mulcontext)
            mulDisplay.CreateGraphics.DrawLine(Pens.Yellow, 0, lngY, screenImageWidth_mulcontext, lngY)    End Sub请教大虾有没有更好的办法能自动清除上次所画的线段,而且速度也很快的办法,谢谢了.十万火急