473,385 Members | 1,409 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,385 software developers and data experts.

flicker

ok, ok...obj.suspendlayout/resumelayout. but it isn't helping and i need
advice. i have a custom progress bar made from a label control. i manually
paint it when the progress changes. i'm drawing a filled, rounded rectangle
twice w/n the label...once to give a light background color, the second time
is the show the progress. the third paint operation is to draw the progress
info text w/n the label. everything works just fine, but when progress
changes rapidly, i get flickering of all text and color layers...even though
i'm suspending layout ops prior to the graphics changes, then resuming.

any ideas on a quick fix...or anyone know how i can apply these graphics
operations to the label all at once?

tia,

steve
Nov 20 '05 #1
4 2166
Step right up young man! You're in the market for a second Graphics object!
What you are doing is animation and animation needs two Graphics objects to
remove that flicker effect. The flicker effect is happening because you are
updating the on-screen graphics object where your eye can see the changes.
Instead, create a second graphics object (an off-screen one), draw the new
image there and then copy it to the on-screen object. If using DirectX,
they even supply routines to time the swap with the vertical refresh which
makes things even better.

"steve" <a@b.com> wrote in message news:10************@corp.supernews.com...
ok, ok...obj.suspendlayout/resumelayout. but it isn't helping and i need
advice. i have a custom progress bar made from a label control. i manually
paint it when the progress changes. i'm drawing a filled, rounded rectangle twice w/n the label...once to give a light background color, the second time is the show the progress. the third paint operation is to draw the progress info text w/n the label. everything works just fine, but when progress
changes rapidly, i get flickering of all text and color layers...even though i'm suspending layout ops prior to the graphics changes, then resuming.

any ideas on a quick fix...or anyone know how i can apply these graphics
operations to the label all at once?

tia,

steve


Nov 20 '05 #2
Steve,
Why a label? I would start with Control or UserControl...

In your user control's constructor you should use the following:
' Stop the flicker
Me.SetStyle(ControlStyles.UserPaint, True)
Me.SetStyle(ControlStyles.DoubleBuffer, True)
Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
Me.SetStyle(ControlStyles.ResizeRedraw, True)
Me.UpdateStyles()

The ControlStyles.DoubleBuffer is .NET's method of having a second Graphics
object as Tyson was suggesting. The other settings help out, see online help
for specifics on each ControlStyle.

After you include the above in your constructor, you only need to handle the
Paint event and paint your control's surface.

Hope this helps
Jay

"steve" <a@b.com> wrote in message news:10************@corp.supernews.com...
ok, ok...obj.suspendlayout/resumelayout. but it isn't helping and i need
advice. i have a custom progress bar made from a label control. i manually
paint it when the progress changes. i'm drawing a filled, rounded rectangle twice w/n the label...once to give a light background color, the second time is the show the progress. the third paint operation is to draw the progress info text w/n the label. everything works just fine, but when progress
changes rapidly, i get flickering of all text and color layers...even though i'm suspending layout ops prior to the graphics changes, then resuming.

any ideas on a quick fix...or anyone know how i can apply these graphics
operations to the label all at once?

tia,

steve

Nov 20 '05 #3

"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:O2**************@TK2MSFTNGP12.phx.gbl...
In your user control's constructor you should use the following:
' Stop the flicker
Me.SetStyle(ControlStyles.UserPaint, True)
Me.SetStyle(ControlStyles.DoubleBuffer, True)
Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
Me.SetStyle(ControlStyles.ResizeRedraw, True)
Me.UpdateStyles()


Golly, looks like I've been working at too low a level. That doublebuffer
thingy sounds neato! I was doing that sort of work myself! I hate it when
languages get so clever but fail to tell me how they can make my coding
simpler!

Nov 20 '05 #4
thanks to you both. works perfectly now. i apparently have also fallen into
the "get so clever/low level" trap.

thanks again,

steve
"Tyson Ackland" <ty***@ona.gov.au> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
|
| "Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
| news:O2**************@TK2MSFTNGP12.phx.gbl...
| > In your user control's constructor you should use the following:
| > ' Stop the flicker
| > Me.SetStyle(ControlStyles.UserPaint, True)
| > Me.SetStyle(ControlStyles.DoubleBuffer, True)
| > Me.SetStyle(ControlStyles.AllPaintingInWmPaint, True)
| > Me.SetStyle(ControlStyles.ResizeRedraw, True)
| > Me.UpdateStyles()
|
| Golly, looks like I've been working at too low a level. That doublebuffer
| thingy sounds neato! I was doing that sort of work myself! I hate it
when
| languages get so clever but fail to tell me how they can make my coding
| simpler!
|
Nov 20 '05 #5

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

Similar topics

1
by: Michael | last post by:
Here is my problem: I have a MDI application and when I load my child forms I get alot of flicker. I have tried to implement double buffering : Public Sub New() MyBase.New() 'This call is...
4
by: Marek Mänd | last post by:
This seems an IE issue only: 4253 bytes testcase: http://www.hot.ee/idaliiga/testcases/ieselect/bnlinkingselectinmsie.htm Can one have 1) a mouseover/mouseout element on TBODY 2) change in...
0
by: mp3boss | last post by:
I am updating a string in the format MM:SS every second using the On_Timer event in Access97 by changing the caption of a label. Even though I'm using 8point text, the box sometimes flickers...
5
by: Ian Stiles | last post by:
I have tried everything under the sun to get rid of horrible flashing and flickering that occurs on a CSharp form when the form hosts a TreeView or WebBrowser control and then you resize the form....
3
by: Per Dunberg | last post by:
Hi all, I have to develop a "skinned" application and I have a problem with the graphics. When a form is loaded and displayed there's aways a flicker where all the controls are located on the...
3
by: seamlyne | last post by:
The first method I ever used for multiple state buttons was to create a graphic for each button for each state: AboutUs_on, AbooutUs_over, AboutUs_out, etc. That works great when there are just a...
17
by: pigeonrandle | last post by:
Hi, I have seen loads of different ways to do this, but the all seem to yield the same result - text that doesn't flicker when it's moving too slowly! Does anyone know 'the best way' to make text...
1
by: Wayne | last post by:
I've noticed some screen flicker when using Access 2003 under Vista and I'm curious as to whether this is a bug or peculiar to my machine. In design view, if I make changes to a form and then...
4
by: Frank Rizzo | last post by:
Hello, I inherited a large Winforms project that is suffering from excessive flicker when switching between portions of the application. I've noticed that most parts of the application (user...
0
by: Rainer Queck | last post by:
Hello NG, I had/have a bad flicker Problem with my Application. On starting some applications, while my app was running, the whole Display started to flicker. Even the desktop Icons! Looking...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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
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.