Ticker Control

Hi,

I am developing a Ticker Control. It is not a smooth ticker but rather a vertical scrolling ticker.

Let's assume the control fills the form and the form is as follows (assume that '.' = space):

| 10:00 Item 1 .. Item 2 .. Item 3 .. Item 4 .......|
| 10:01 Item 5 .. Item 6 .. Item 7 .. Item 8 .......|
| 10:02 Item 9 .. Item 10 .. Item 11 .................|

When Item 12 arrives, it will appear after Item 11. Then when Item 13 arrives I would like to scroll the line at "10:00" off the screen so it would then look like:

| 10:01 Item 5 .. Item 6 .. Item 7 .. Item 8 .......|
| 10:02 Item 9 .. Item 10 .. Item 11 .. Item 12 ..|
| 10:03 Item 13 ..............................................|

I am implementing this using DoubleBuffering (although not using the ControlStyles, but with my own managing of Bitmaps.) Whenever an Item arrives I first Draw it to the Background Bitmap at the proper location and then using DrawImage I draw the Background Bitmap to the screen. (Currently I do the whole image not just the modified rectangle, I just started writing this, I haven't tweaked it yet.) Then when a WM_PAINT is received I just DrawImage the Background Bitmap using only the Clipped Region.

When the user Resizes the window I recreate the Background Bitmap using the new Client Coordinates of the window, then the Bitmap is cleared and Drawn back onto the screen. (Yes when the user resizes, all of the information is lost. This is what the user wants.)

After my long winded explanation, Now onto the question:
I am not convinced that I am doing the Background Bitmap correctly. Would it be better to, upon creation of the Ticker create a Bitmap that is large enough to fill the entire screen and use a Clipping Region to handle all of this? Is there another way? Or am I going about this the right way?

I can't do this in WM_PAINT since Items arrive on a queue and need to be dequeued as quickly as possible (Items can come in to the machine at a rate of 1000/sec at peak times, although they all won't appear on the Ticker.).

Thanks for your help,
Chris

[2125 byte] By [codefund.com] at [2007-12-16]
# 1
Hi Chris,

I presume that (despite using double buffering) relying on standard windows forms controls would be too slow for your requirements?

You could spare a lot of programming hassle if you just filled a listview, I suppose.

Just my 2c.
Heiko

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms Designer...
# 2
Chris, why are you unconvinced that you are doing this improperly? Are you seeing bad performance?

If you can provide an example of the behavior you aren't happy with, we may be able to help you out.

thanks
- mike

codefund.com at 2007-9-8 > top of Msdn Tech,Windows Forms,Windows Forms Designer...