Re: GDI+ Custom Control
- From: Joseph M. Newcomer <newcomer@xxxxxxxxxxxx>
- Date: Wed, 01 Apr 2009 13:38:57 -0500
OK, the way to do this is as follows:
I have actually done this already; my first MFC program was a medical data display and I
had to optimize scrolling on a 20MHz 386.
First, I would treat each of the "tiles" as being a separate window, each a child window
of the overall graph. This simplifies a lot of the comptuations. I did it by using
splitter windows and having (to use your examples) a heart rate view, a blood pressure
view, etc., one per split window. Today, I might consider using a CFormView and using
distinct child windows (custom CStatic with OnPaint handlers) because of the problems I
had in getting all the windows to scroll in synchrony (the WM_HSCROLL messages were sent
only to the active splitter view)
You have the data with some kind of position information (time stamp, sample # count,
etc.)
You have displayed samples from Tn...Tm for n and m being some indicator
You scroll the tile. To do this, you would use ScrollWindow. This will call
InvalidateRect on the exposed rectangle.
OnPaint is called. I used DPtoLP on the invalidation rectangle to compute the Tm..Tk
range that needed to be plotted, and plotted only that part.
To speed up the plot, what I did was scan the input data (4 megasamples) and do a data
reduction so I had no more points to plot than screen resolution. So if I had to plot the
entire 4 megasamples on an 800-pixel box, I would compute the max and min over 5000
samples and draw a vertical line min..max at the corresponding Ti position; the sample "i"
on the screen represented 5000 samples. Doing this with PolyLine made it go even faster.
joe
On Wed, 1 Apr 2009 16:11:32 +0100, "fallenidol" <fallenidol@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
Hello,.
I am currently beginning development of a custom charting control which
shall be used to display medical trend data such as Heart Rate and Blood
Pressure etc. The control will be made up of several horizontal "tiles"
which run the width of the control. So there would be one "tile" for Heart
Rate (say 150px high) and another "tile" below that for Blood Pressure (also
150px). To complicate matters each title needs to "scroll" in a manner
similar to Google Maps. In other words when a title is scrolled horizontally
the chart needs to start constructing images of the graph and buffering them
behind the scenes since redrawing the whole "tile" in real-time would be too
slow.
I'm kind of struggling to think of the best way to implement this so any
suggestions would be helpful. I'm unsure if i need to have just one
usercontrol and use gdi+ to draw everything inside the one control or
whether i should have have one usercontrol as a container and then have
several other usercontrol inside i.e one for each "tile".
I hope this makes sense and look forward to any suggestions you might have.
Thanks.
- References:
- GDI+ Custom Control
- From: fallenidol
- GDI+ Custom Control
- Prev by Date: GDI+ Custom Control
- Next by Date: Re: Drawing text exactly in GDI+
- Previous by thread: GDI+ Custom Control
- Next by thread: Re: Drawing text exactly in GDI+
- Index(es):
Relevant Pages
|