473,378 Members | 1,099 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,378 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 965

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...
15
by: charlie fortune | last post by:
I'm quite new to HTML, and have seen <marquee> get bad press here. What's wrong with using it. I wanted to have the contents of a .txt file scrolling for news items, can I do this with marquee, or...
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....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...

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.