Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Scrolling Marquee too slow! 1

Status
Not open for further replies.

RickBerem

Programmer
Jan 18, 2001
156
CA
Hello everyone!

Ok, I made this program that is, mainly, a Clock that displays messages stored in a db. (it can also show a slideshow of images but this part works)

My problem is:
The scrolling speed is slow... The computer that will be used to run this is a 733 with 256mb ram and Windows 2000 and runs nothing else.

I use DrawString and a timer to move the marquee. I invalidate only the part that needs to be updated... But it's still slow. (eats up 98% of the cpu according to taskmanager)

Removing the second timer (updates the time on each second) makes things a little better but still a no go.

I probably am doing something wrong.
Anyone has ideas or pointers for me on that one?

Thanks in advance for your help!


SG
 
right, little detail.

it's displayed on a 1680 X 1050 screen
So the Marquee is pretty big.

SG
 
A bit more info would be helpfull...

You say that you are using timers? What interval are they set to?

Or are you using a loop, this is a common 100% cpu usage problem.

How are you displaying the graphics? With OnPaint? event fired by timer? or in a loop?
 
Hey,

Ok info coming up

The timer is set to interval : 1
the graphics are drawn in the Paint event using the Invalidate function of the control I paint on. Fired by the timer.

Hope this clears some fog.

SG
 
a timer to move the marquee ??
> Why do you use a timer? By saying 'marquee' I assume that you use vb.net 2005 version. If you set the progressbar to 'marquee' then you set MarqueeAnimationSpeed, and you are OK without a timer.
I don't know if this is your problem, but you must run the progessbar from a different thread. (parallel processing)

It seems that the progressbar does not have some 'spare' time to update its animation. The same happens below.... even if it is a label control.

dim i as integer
for i=0 to 34000
label1.text=i.tostring()
next

The above do not work as it should; the label will show the last value only. To fix it, you normally add a 'Application.Doevents()' in the for/loop. The solution with the progress bar is to start it from a different thread.


Regards.
 
You may want to slow down the timer and add more jumps in the DrawString location (example bellow),

I use between 70-100 for a frame rate timer in general, and then just work out what is best with the number of frames(jumps) to generate the speed.
Code:
...
MyTimer.Interval = 75
...

Dim x as Integer
Dim Jump as Integer = 5 'Pixels per render...

Sub MyTimer_Tick(..., ...)
  If x > 1680 Then
   x = 0
  Else
   x += Jump
  End If
  
  MyFrame.Invalidate() 'you could supply region to speed up more
End Sub

...
I think (by the sounds of it) that you have got the rest of the code alright.

Hope this helps.
 
Thanks for the help!

Yes, I ended up doing more pixel per tick to speed it up.

By Marquee I meant the equivalent of the <marquee> tag in HTML. I thought it was the correct name for "scrolling left to right text"

Thanks again for all your inputs.

SG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top