473,772 Members | 3,731 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Flickering when resizing controls...

I have a form with a number of panel controls on it. I have overriden the
paint event (of the panel controls) to provide custom painting. What I have
done is to use the Paint event to paint the background colour of a number of
panel controls to be a gradient colour. This works fine. Is there a better
way??

The problem I have is that when I resize the parent form I get alot of
flickering as the paint events are constantly fired. I have used Double
Buffering where possible but this does not appear to resolve the problem.

Any suggestions for reducing flickering when resizing controls with
overriden Paint events?

Many thanks.
Feb 16 '07 #1
1 2712
If your call is to paint the background of the panel, then you might
consider overridng OnPaintBackgrou nd instead of OnPaint. There is also
a style property you can use in the contructor to affect whether
things are redrawn when the control is sized. (But normally, you need
the redrawing to happen to dynamically see your sizing.)

public class MyPanel : Panel
{
public MyPanel()
{
SetStyle(Contro lStyles.ResizeR edraw, true);
}

protected override void OnPaintBackgrou nd(PaintEventAr gs e)
{
// base.OnPaintBac kground(e);
using (Brush b = new
System.Drawing. Drawing2D.Linea rGradientBrush( new Point(0, 0), new
Point(this.Clie ntSize.Width, this.ClientSize .Height),
Color.Red, Color.Blue))
{
e.Graphics.Fill Rectangle(b, this.ClientRect angle);
}

}
protected override void OnPaint(PaintEv entArgs e)
{
base.OnPaint(e) ;
}
}
==============
Clay Burch
Syncfusion, Inc.

Feb 16 '07 #2

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

Similar topics

8
16929
by: benben | last post by:
I created a form and overrided OnPaint, OnClick and OnResize methods. My OnPaint calls base.OnPaint then repaints the whole screen. The screen flickers a lot! It didn't happen when the app was written in C++. What is the general strategy to reduce screen flickering with C# Forms? Perhaps saving the screen as a bitmap and just bitblip when painted, and only change the bitmap when necessary? is it possible? ben
4
1942
by: vani | last post by:
Hi I am fresher in VC++. I am working on a VC++ Project. I have a serious flickering problem when i am resizing the window. Please help me. vani
5
4377
by: Jim Hubbard | last post by:
Has anyone seen a fix for the flickering effect you get when resizing a Webbrowser control? It's really irritating and doesn't make for a professional-looking application.
5
2351
by: n00b | last post by:
I have some forms with maybe around 30 controls on each and anytime I load these forms different parts of it start flickering though not all of them at once and not the same ones everytime. the forms are each generally separated into 2-3 different panels and they start flickering with no apparent pattern. I've tried turning on double buffering, same thing, no improvements. I've tested it on different computers with different specifications...
5
9525
by: jtalbot_vizible | last post by:
I was looking at the code on codeproject to solve my listview flickering issue. All the references to functions in the rest of my post refer to that code. It's available at http://www.codeproject.com/cs/miscctrl/listviewff.asp?df=100&forumid=14314&select=1488858&msg=1488858 That code didn't solve my problem. I have a ListView (in Details mode) with about 70 rows and 12 columns. It's a stock ticker kind of app. When it first starts, each...
3
7932
by: Maya | last post by:
Hi all, We have a windows forms application with different controls used inside, each control has several input items such as textboxes and some treeviews.. etc. We have been trying to eliminate flickering issues when loading different controls or switching to different views with no luck, and
1
2404
by: James | last post by:
Hi all, I have made a derived Listview which can accept the controls as items in it. Controls that we are using are Buttons in each row and implemented Grouping with the help of controls(label on panel) . Coz Inbuilt listview Grouping not supported in OS like window 98. Although I had used Double buffering (SetStyle(ControlStyles.DoubleBuffer, true); .. in my Listview) but still the listview flickers much when we scroll its items. ...
0
1598
by: James | last post by:
Hi all, I have made a derived Listview in C# .net 1.1 framework, which can accept the controls as items in it. Controls that we are using are Buttons in each row and implemented Grouping with the help of controls(label on panel) . Coz Inbuilt listview Grouping not supported in OS like window 98. Although I had used Double buffering (SetStyle(ControlStyles.DoubleBuffer, true); .. in my Listview) but still the listview flickers much...
1
3471
by: sj | last post by:
Flickering Subform! I am developing a Quotation system in Access 03. At entry, users enter data thru' a form with subform. However, the subform keep flicker when I run the system on computer using runtime. This problem don't happen on set that has full ver of Access. Any advise? Pls Help, I have pulled off so much hair on this.
0
9620
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
9454
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10261
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10104
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...
0
9912
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8934
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...
0
5354
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
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3609
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.