开发者

Plotting points and then removing them

I have a set of points plotted. After I scroll the trackbar I want them to disappear and a new set of points to appear. Now the problem is the I cannot add the code for adding the points in the Paint method itself because it involves a lot of calculations and so is not efficient. I tried using Invalidate() but in that case my points appear for a fraction of a second t开发者_开发问答hen disappear. I want them to be displayed till I click on the button or move the trackbar.

How to go about doing it.

Thanks.


In your function that calculates the points, store the points into a list. In the paint function, draw according to the list. When required to change the points, simply clear the list of points and store new ones. Remember to Invalidate()

This way, each time Paint is called, the points are drawn. you can still separately update your list in some other functions.

When you mention the points appearing then disappearing, it seems that you drew the points outside the paint function. Is that true? When something happens paint draws over your drawing.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜