I work on a data acquisition system. I need to display data as it comes.
There are two different modes: 1. Display only current set of data each time
it is ready. 2. Display the current data, but don't erase the previous one.
I remember in MFC I was able to do this by changing one parameter
(DrawBackground() or something like that). I am trying to do it with C# and
failing.
If I use Invalidate() or Invalidate(rect) functions, than the previous data
is erased. However if I just use my plotting functions directly to display
the data, then I need to create Graphics (this.CreateGraphics) and pass it to
the plotting routine. But then the program crashes some time when I try to
resize the window for example. It tells me that a Brush (or Color, etc...) is
used somewhere.
I think it is because I have two requests for plotting data with two
different Graphics: one is coming from acquisition board when the data is
ready, and the other - from Windows when I resize the window.
Is there any way to use Invalidate() but somehow specify not to erase the
background? This would solve all the problems as I did not have to create
another Graphics and just use the one that is generated by .NET in the Paint
message.
Thank you in advance,
Viktor