Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27329

VS 2010 Redraw existing lineshape with new data.

$
0
0
I am drawing a line graph from x,y data points derived from user entered data. This is all done at runtime. This part is working OK. However, if the user enters one or more new data points and the new x,y pairs are re-calculated the new line graph, using the same set of lineshape items, is drawn in addition to the original line graph. My intention is to replace the old data plot with the new data plot. I have tried .update(), .dispose() and others. At best it is just ignored at worst I get a runtime error indicating an item that has not been defined. A small portion of code:

MoldCanvas.Parent = Me

LineSeg1.Parent = MoldCanvas
LineSeg1.BorderColor = Color.Green
LineSeg1.BorderWidth = 3
LineSeg1.StartPoint = New System.Drawing.Point(MoldGraphX(0), MoldGraphY(0))
LineSeg1.EndPoint = New System.Drawing.Point(MoldGraphX(1), MoldGraphY(1))

LineSeg2.Parent = MoldCanvas
LineSeg2.BorderColor = Color.Green
LineSeg2.BorderWidth = 3
LineSeg2.StartPoint = LineSeg1.EndPoint
LineSeg2.EndPoint = New System.Drawing.Point(MoldGraphX(2), MoldGraphY(2))

LineSeg3.Parent = MoldCanvas
LineSeg3.BorderColor = Color.Green
LineSeg3.BorderWidth = 3
LineSeg3.StartPoint = LineSeg2.EndPoint
LineSeg3.EndPoint = New System.Drawing.Point(MoldGraphX(3), MoldGraphY(3))

I would like to call this routine again with the new data and only have one graph shown.

So, in short, how do I get each of the LineSeg? to take the new data and only have one representative of this segment on the screen?

Best regards and tia,

Dave

Viewing all articles
Browse latest Browse all 27329

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>