invalidate (rect)

  • Thread starter Thread starter Miliuccio
  • Start date Start date
M

Miliuccio

haw to save background before draw a line and have a continous adding of
points in my panel?

i call invalidate(rect) and it cancel the rect and make the new drawline.
 
Private Sub Panel1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint

Dim blackPen As New Pen(Color.Black)
e.Graphics.DrawLine(blackPen, x1, y1, x, y)

End Sub


Private Sub Panel1_MouseMove(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles Panel1.MouseMove

x1 = x
y1 = y
x = e.X
y = e.Y
Dim rect As Rectangle
rect.X = x
rect.Y = y
rect.Width = 1
rect.Height = 1
Panel1.Invalidate(rect)

End Sub

so i make a discontinous line of dots.
i want to link dots with lines.
but the invalidate(rect) delete the background any time,
haow can i save the background before to write the line?
 
You'd be better of by overriding the OnPaint and drawing the background image
first and the line.

Take a look at this article t
 
Back
Top