473,396 Members | 1,757 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Reader board marquee graphics optimization

Hello,

This is a bit of a long post (sorry) but here is the jist of it:
I've developed a Windows forms User Control marquee (auto-scrolling
text like a readerboard). I'm trying to optimize it so that it'll
display very large strings with out comsuming so many resources. That
is, as the size of the display string increases, the marquee uses
additional CPU cycles.

I've considered two possible solutions.

The easiest solution would be if there were a way to make the GDI+
Graphics.DrawString handle large strings gracefully. I'm not a very
experienced graphics programmer myself. I've been looking at
providing a Clip area (Graphics.Clip) Region. However, this didn't
seem to solve the performance problem. I've also tried providing a
rectangular bounds (RectangleF) to the DrawString method. However,
this hasn't had any impact on performance either. You can see my
current OnPaint() method below. Some of these past ideas are commented
out therein.
I've considered splitting up the DisplayText string and only displaying
one portion at a time. However, this solution introduces some other
difficulties. Mainly, keeping track of the last StringWidth/Length and
calculating the correct x, y coords as the next string is loaded.

Here is the method. I haven't shown how I provide the clip area as
that is done in at Init().

protected override void OnPaint(PaintEventArgs e)
{
_gfx = e.Graphics;

// only load the brushes if new color
if(bNewColor)
LoadBrushes();

// only build the graphic string if new string
if(bNewText)
BuildStringGraphic(e.Graphics);

// draw BG
_gfx.FillRectangle(BrushBG, 0, 0, Width, Height);

// draw the string at the
_gfx.DrawString(_sbDisplayCurrent.ToString(), _font,
BrushFG, x, y);

// draw string inside of rectangle
//_gfx.DrawString(_sbDisplayCurrent.ToString(), _font,
// BrushFG,
// new RectangleF(new PointF(x, y), new SizeF
// (this.Width, this.Height)), sf);
}

Nov 17 '05 #1
0 1369

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jo_Calico | last post by:
I love the Dynamic Drive cross browser marquee script. I'd like to make the text loop immediately after completion, so the beginning runs right after the end (does that make sense?). Could anyone...
1
by: Sketcher | last post by:
Hi all, I am looking to add the following scrolling marquee to my website (see code below) However instead of using the marquee methods I want to use and as a person rests their mouse on...
0
by: twostepted | last post by:
Hello, This is a bit of a long post (sorry) but here is the jist of it: I've developed a Windows forms User Control marquee (auto-scrolling text like a readerboard). I'm trying to optimize it...
6
by: Supra | last post by:
i got board working using graphic window in vb.net but no controls adding to form. i am doing checker board game. when i clicked and moved the peg to another location(grid). but how do i get bitmap...
2
by: P2P | last post by:
Hi I am wondering if someone can help me here with the "perfect" marquee vertical scrolling script I've found. This marquee is great for me as it will call an external html page. This allow...
56
by: Ed Jay | last post by:
I note in an Eric Meyers book that he expresses one goal of using CSS is to eliminate all <brtags. Why? -- Ed Jay (remove 'M' to respond by email)
8
praclarush
by: praclarush | last post by:
Ok, I'm new to JavaScript and I'm taking a class for it the assignment in it I'm supposed to create edit a pre-made page to display a marquee that automatically scrolls for the user, as well as give...
5
by: 000baaa000 | last post by:
The following HTML marquee code works better in Microsoft Internet Explorer, breaks (in more than one way) in Mozzila Firefox <pre>------------------------------------------------- start HTML...
3
by: Rajneesh Chellapilla | last post by:
Hi I made this marquee program however, I am having trouble getting all four marquees to line up correctly. Basically I want the the 4 marquees to line up on the four sides exactly so they intersect....
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.