473,656 Members | 2,777 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

flicker

ok, ok...obj.suspen dlayout/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 2182
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.super news.com...
ok, ok...obj.suspen dlayout/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(Con trolStyles.User Paint, True)
Me.SetStyle(Con trolStyles.Doub leBuffer, True)
Me.SetStyle(Con trolStyles.AllP aintingInWmPain t, True)
Me.SetStyle(Con trolStyles.Resi zeRedraw, True)
Me.UpdateStyles ()

The ControlStyles.D oubleBuffer 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.super news.com...
ok, ok...obj.suspen dlayout/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******** ******@TK2MSFTN GP12.phx.gbl...
In your user control's constructor you should use the following:
' Stop the flicker
Me.SetStyle(Con trolStyles.User Paint, True)
Me.SetStyle(Con trolStyles.Doub leBuffer, True)
Me.SetStyle(Con trolStyles.AllP aintingInWmPain t, True)
Me.SetStyle(Con trolStyles.Resi zeRedraw, 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******** ********@TK2MSF TNGP10.phx.gbl. ..
|
| "Jay B. Harlow [MVP - Outlook]" <Ja************ @msn.com> wrote in message
| news:O2******** ******@TK2MSFTN GP12.phx.gbl...
| > In your user control's constructor you should use the following:
| > ' Stop the flicker
| > Me.SetStyle(Con trolStyles.User Paint, True)
| > Me.SetStyle(Con trolStyles.Doub leBuffer, True)
| > Me.SetStyle(Con trolStyles.AllP aintingInWmPain t, True)
| > Me.SetStyle(Con trolStyles.Resi zeRedraw, 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
5010
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 required by the Windows Form Designer.
4
3863
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 thoise event handler background colors 3) have a specified heighted SELECT element, that doesnt flicker when the event handlers are get called.
0
1902
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 (transparent background changes to light-gray before reverting back to transparent). The text is drawn on top of a rectangle that is on top of a form that may have an embedded picture. If I create a very-simple form without all of these elements, I...
5
6651
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. Here is what I've tried so far: 1. Turning off CS_VREDRAW and CS_HREDRAW in both the parent form and a subclass of the control via the "override CreateParams" property (these values were already off). 2. Setting various styles and handling...
3
3520
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 form. It seems like the controls erase the background and this cause a flicker everytime a form i loaded. When I hide and show forms that are already loaded there's no flicker, it's just when the form is loaded the first time.
3
5666
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 few buttons. I'm creating interfaces now with many more buttons than "just a few". I solved the maintenance problem by having generic button images, one for each state, and having them be background images for text containers, DIVs in this...
17
4706
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 scroll... eg Override OnPain and OnPaintBackground Override WndProc
1
3656
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 close the form, a couple of seconds after I have OKed the save prompt the Database Window that shows all my objects gives one flicker. Once again, in design view if I change a property for a control in the Properties box and then move the mouse...
4
10753
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 controls and forms) have DoubleBuffered set to true. In addition to that, in the constructor of every form and user control, there is this line: SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.OptimizedDoubleBuffer, true);
0
1142
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 for help on this issue, I ran over a anser Linda Liu at : http://groups.google.de/group/microsoft.public.dotnet.languages.csharp/browse_thread/thread/39e9f7d0b96b048f?hl=de where I found the following (quick and dirty )solution to the flicker
0
8382
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8717
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8498
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7311
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6162
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5629
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4150
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4300
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2726
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.