0

In c# I have a panel with thousands of coordinates plotted and need to draw a rectangle to zoom into.

Drawing the rectangle is not a problem.

The problem is drawing the rectangle on top of the data without having to replot the data all the time.

I am using the onPaint event. I hope someone can understand and help

TaW
  • 53,122
  • 8
  • 69
  • 111
  • 1
    Are you using any library? Tool? – Thomas Ayoub Apr 19 '17 at 15:29
  • 2
    Share your source,please – Samvel Petrosov Apr 19 '17 at 15:29
  • Don't fill the rectangle? – LarsTech Apr 19 '17 at 15:32
  • if I remember correctly there is a way of painting only a portion of the painting area, I can't recall the specifics now though. Would repainting only the portion covered by the rectangle work for you? – Luiso Apr 19 '17 at 15:33
  • I am not using any library tool, just normal mouse up down and move. Also I have a filled in blue area that I plot onto, and removing the fill makes no difference. Someone suggested that I save a copy of the background as an image, load the image and draw the rectangle on top of the image. If so how would I go about that – user2618634 Apr 19 '17 at 16:43
  • Yes, thousands of data should be collected into a Bitmap! - you can combine a BackgroundImage with plotting the latest Points and the selection rectangle or even a DrawImage.. – TaW Apr 19 '17 at 17:37
  • See [here for a discussion with an example!](http://stackoverflow.com/questions/27623365/existing-graphics-into-bitmap/27647011?s=1|8.1372#27647011) – TaW Apr 19 '17 at 17:54
  • @TaW thank you for your example. I have been away for the last few days and back now. Will try it and see if that sorts out the problem. Appreciate the effort – user2618634 Apr 24 '17 at 10:02

0 Answers0