[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.drawing

Transparent User Controls flickering with repaint

brandonshuey

11/24/2004 8:19:00 PM

I have been struggling with this for awhile now and tried many
approaches, I'm hoping someone out there can give me a hand.

The problem is I want transparent controls (label, groupbox, etc) to
paint on a gradient panel. The flickering come when I move a
different window over my form and drag it away (quickly). I have
implemented most of the commonly prescribed solutions but none solve
the problem. Here is the one that I think performs the best. Can
someone tell me if this is a problem with GDI+ or am I missing
something.

I'm using a transparent label in a transparent groupbox on a gradient
form. The controls all are employing the following in their
constructor:
InitializeComponent();
this.SetStyle(ControlStyles.AllPaintingInWmPaint |
ControlStyles.SupportsTransparentBackColor ,true);
this.UpdateStyles();
this.BackColor = Color.Transparent;
I am also using this method, perscribed by Bob Powell,
protected override CreateParams CreateParams
{
get
{
CreateParams cp=base.CreateParams;
cp.ExStyle|=0x00000020; //WS_EX_TRANSPARENT
return cp;
}
}
Below is my code if you want to try what I mean with the command
window over the form:
******************
using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

namespace TransparentControls
{
/// <summary>
/// Summary description for TransparentGroupbox.
/// </summary>
public class TransparentGroupbox : System.Windows.Forms.GroupBox
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public TransparentGroupbox()
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
this.SetStyle(ControlStyles.AllPaintingInWmPaint |
ControlStyles.SupportsTransparentBackColor ,true);
this.UpdateStyles();
this.BackColor = Color.Transparent;
// TODO: Add any initialization after the InitializeComponent call

}

protected override CreateParams CreateParams
{
get
{
CreateParams cp=base.CreateParams;
cp.ExStyle|=0x00000020; //WS_EX_TRANSPARENT
return cp;
}
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace TestControl
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private com.KeyCentrix.UI.Common.GradientPanel gradientPanel1;
private TransparentControls.TransparentPanel transparentPanel1;
private TransparentControls.TransparentLabel transparentLabel1;
private TransparentControls.TransparentGroupbox
transparentGroupbox1;
private TransparentControls.TransparentGroupbox
transparentGroupbox2;
private TransparentControls.TransparentLabel transparentLabel2;
private TransparentControls.TransparentLabel transparentLabel3;
private TransparentControls.TransparentLabel transparentLabel4;
private TransparentControls.TransparentLabel transparentLabel5;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
this.SetStyle(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
this.UpdateStyles();
//
// TODO: Add any constructor code after InitializeComponent call
//
}


/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.gradientPanel1 = new com.KeyCentrix.UI.Common.GradientPanel();
this.transparentGroupbox2 = new
TransparentControls.TransparentGroupbox();
this.transparentLabel4 = new
TransparentControls.TransparentLabel();
this.transparentLabel2 = new
TransparentControls.TransparentLabel();
this.transparentGroupbox1 = new
TransparentControls.TransparentGroupbox();
this.transparentLabel5 = new
TransparentControls.TransparentLabel();
this.transparentLabel1 = new
TransparentControls.TransparentLabel();
this.transparentPanel1 = new
TransparentControls.TransparentPanel();
this.transparentLabel3 = new
TransparentControls.TransparentLabel();
this.gradientPanel1.SuspendLayout();
this.transparentGroupbox2.SuspendLayout();
this.transparentGroupbox1.SuspendLayout();
this.SuspendLayout();
//
// gradientPanel1
//
this.gradientPanel1.AltBackColor =
System.Drawing.Color.FromArgb(((System.Byte)(64)),
((System.Byte)(64)), ((System.Byte)(0)));
this.gradientPanel1.BackColor =
System.Drawing.SystemColors.GrayText;
this.gradientPanel1.Controls.Add(this.transparentGroupbox2);
this.gradientPanel1.Controls.Add(this.transparentGroupbox1);
this.gradientPanel1.Controls.Add(this.transparentPanel1);
this.gradientPanel1.GradientAngle = 0F;
this.gradientPanel1.Location = new System.Drawing.Point(28, 68);
this.gradientPanel1.Name = "gradientPanel1";
this.gradientPanel1.Size = new System.Drawing.Size(520, 384);
this.gradientPanel1.TabIndex = 9;
//
// transparentGroupbox2
//
this.transparentGroupbox2.BackColor =
System.Drawing.Color.Transparent;
this.transparentGroupbox2.Controls.Add(this.transparentLabel4);
this.transparentGroupbox2.Controls.Add(this.transparentLabel2);
this.transparentGroupbox2.Location = new System.Drawing.Point(24,
44);
this.transparentGroupbox2.Name = "transparentGroupbox2";
this.transparentGroupbox2.TabIndex = 5;
this.transparentGroupbox2.TabStop = false;
this.transparentGroupbox2.Text = "transparentGroupbox2";
//
// transparentLabel4
//
this.transparentLabel4.BackColor =
System.Drawing.Color.Transparent;
this.transparentLabel4.Location = new System.Drawing.Point(40, 64);
this.transparentLabel4.Name = "transparentLabel4";
this.transparentLabel4.TabIndex = 1;
this.transparentLabel4.Text = "transparentLabel4";
//
// transparentLabel2
//
this.transparentLabel2.BackColor =
System.Drawing.Color.Transparent;
this.transparentLabel2.Location = new System.Drawing.Point(28, 24);
this.transparentLabel2.Name = "transparentLabel2";
this.transparentLabel2.TabIndex = 0;
this.transparentLabel2.Text = "transparentLabel2";
//
// transparentGroupbox1
//
this.transparentGroupbox1.BackColor =
System.Drawing.Color.Transparent;
this.transparentGroupbox1.Controls.Add(this.transparentLabel1);
this.transparentGroupbox1.Location = new System.Drawing.Point(256,
40);
this.transparentGroupbox1.Name = "transparentGroupbox1";
this.transparentGroupbox1.TabIndex = 4;
this.transparentGroupbox1.TabStop = false;
this.transparentGroupbox1.Text = "transparentGroupbox1";
//
// transparentLabel5
//
this.transparentLabel5.BackColor =
System.Drawing.Color.Transparent;
this.transparentLabel5.Location = new System.Drawing.Point(0, 0);
this.transparentLabel5.Name = "transparentLabel5";
this.transparentLabel5.TabIndex = 0;
//
// transparentLabel1
//
this.transparentLabel1.BackColor =
System.Drawing.Color.Transparent;
this.transparentLabel1.Location = new System.Drawing.Point(-8, 24);
this.transparentLabel1.Name = "transparentLabel1";
this.transparentLabel1.TabIndex = 2;
this.transparentLabel1.Text = "transparentLabel1";
//
// transparentPanel1
//
this.transparentPanel1.Location = new System.Drawing.Point(184,
184);
this.transparentPanel1.Name = "transparentPanel1";
this.transparentPanel1.TabIndex = 1;
//
// transparentLabel3
//
this.transparentLabel3.BackColor =
System.Drawing.Color.Transparent;
this.transparentLabel3.Location = new System.Drawing.Point(0, 0);
this.transparentLabel3.Name = "transparentLabel3";
this.transparentLabel3.TabIndex = 0;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.BackColor = System.Drawing.SystemColors.Desktop;
this.ClientSize = new System.Drawing.Size(584, 490);
this.Controls.Add(this.gradientPanel1);
this.Name = "Form1";
this.Text = "Form1";
this.gradientPanel1.ResumeLayout(false);
this.transparentGroupbox2.ResumeLayout(false);
this.transparentGroupbox1.ResumeLayout(false);
this.ResumeLayout(false);

}
#endregion

/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
}
}

using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

namespace TransparentControls
{
/// <summary>
/// Summary description for TransparentLabel.
/// </summary>
public class TransparentLabel : System.Windows.Forms.Label
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public TransparentLabel()
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();
SetStyle(ControlStyles.SupportsTransparentBackColor,true);
SetStyle(ControlStyles.DoubleBuffer, true);
this.SetStyle(ControlStyles.AllPaintingInWmPaint |
ControlStyles.SupportsTransparentBackColor,true);
this.UpdateStyles();
this.BackColor = Color.Transparent;
}


/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

protected override CreateParams CreateParams
{
get
{
CreateParams cp=base.CreateParams;
cp.ExStyle|=0x00000020; //WS_EX_TRANSPARENT
return cp;
}
}

#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
components = new System.ComponentModel.Container();
}
#endregion
}
}
3 Answers

Bob Powell

11/25/2004 10:50:00 AM

0

They can't do much else. They have to paint the parent's background before
they paint themselves. Transparent controls are a royal pain.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tips...

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/f...

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.





"Brandon" <brandonshuey@sbcglobal.net> wrote in message
news:fde65c94.0411241218.53e34b5e@posting.google.com...
> I have been struggling with this for awhile now and tried many
> approaches, I'm hoping someone out there can give me a hand.
>
> The problem is I want transparent controls (label, groupbox, etc) to
> paint on a gradient panel. The flickering come when I move a
> different window over my form and drag it away (quickly). I have
> implemented most of the commonly prescribed solutions but none solve
> the problem. Here is the one that I think performs the best. Can
> someone tell me if this is a problem with GDI+ or am I missing
> something.
>
> I'm using a transparent label in a transparent groupbox on a gradient
> form. The controls all are employing the following in their
> constructor:
> InitializeComponent();
> this.SetStyle(ControlStyles.AllPaintingInWmPaint |
> ControlStyles.SupportsTransparentBackColor ,true);
> this.UpdateStyles();
> this.BackColor = Color.Transparent;
> I am also using this method, perscribed by Bob Powell,
> protected override CreateParams CreateParams
> {
> get
> {
> CreateParams cp=base.CreateParams;
> cp.ExStyle|=0x00000020; //WS_EX_TRANSPARENT
> return cp;
> }
> }
> Below is my code if you want to try what I mean with the command
> window over the form:
> ******************
> using System;
> using System.Collections;
> using System.ComponentModel;
> using System.Drawing;
> using System.Data;
> using System.Windows.Forms;
>
> namespace TransparentControls
> {
> /// <summary>
> /// Summary description for TransparentGroupbox.
> /// </summary>
> public class TransparentGroupbox : System.Windows.Forms.GroupBox
> {
> /// <summary>
> /// Required designer variable.
> /// </summary>
> private System.ComponentModel.Container components = null;
>
> public TransparentGroupbox()
> {
> // This call is required by the Windows.Forms Form Designer.
> InitializeComponent();
> this.SetStyle(ControlStyles.AllPaintingInWmPaint |
> ControlStyles.SupportsTransparentBackColor ,true);
> this.UpdateStyles();
> this.BackColor = Color.Transparent;
> // TODO: Add any initialization after the InitializeComponent call
>
> }
>
> protected override CreateParams CreateParams
> {
> get
> {
> CreateParams cp=base.CreateParams;
> cp.ExStyle|=0x00000020; //WS_EX_TRANSPARENT
> return cp;
> }
> }
>
> /// <summary>
> /// Clean up any resources being used.
> /// </summary>
> protected override void Dispose( bool disposing )
> {
> if( disposing )
> {
> if(components != null)
> {
> components.Dispose();
> }
> }
> base.Dispose( disposing );
> }
>
> #region Component Designer generated code
> /// <summary>
> /// Required method for Designer support - do not modify
> /// the contents of this method with the code editor.
> /// </summary>
> private void InitializeComponent()
> {
> components = new System.ComponentModel.Container();
> }
> #endregion
> }
> }
>
> using System;
> using System.Drawing;
> using System.Collections;
> using System.ComponentModel;
> using System.Windows.Forms;
> using System.Data;
>
> namespace TestControl
> {
> /// <summary>
> /// Summary description for Form1.
> /// </summary>
> public class Form1 : System.Windows.Forms.Form
> {
> private com.KeyCentrix.UI.Common.GradientPanel gradientPanel1;
> private TransparentControls.TransparentPanel transparentPanel1;
> private TransparentControls.TransparentLabel transparentLabel1;
> private TransparentControls.TransparentGroupbox
> transparentGroupbox1;
> private TransparentControls.TransparentGroupbox
> transparentGroupbox2;
> private TransparentControls.TransparentLabel transparentLabel2;
> private TransparentControls.TransparentLabel transparentLabel3;
> private TransparentControls.TransparentLabel transparentLabel4;
> private TransparentControls.TransparentLabel transparentLabel5;
> /// <summary>
> /// Required designer variable.
> /// </summary>
> private System.ComponentModel.Container components = null;
>
> public Form1()
> {
> //
> // Required for Windows Form Designer support
> //
> InitializeComponent();
> this.SetStyle(ControlStyles.DoubleBuffer, true);
> this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
> this.UpdateStyles();
> //
> // TODO: Add any constructor code after InitializeComponent call
> //
> }
>
>
> /// <summary>
> /// Clean up any resources being used.
> /// </summary>
> protected override void Dispose( bool disposing )
> {
> if( disposing )
> {
> if (components != null)
> {
> components.Dispose();
> }
> }
> base.Dispose( disposing );
> }
>
> #region Windows Form Designer generated code
> /// <summary>
> /// Required method for Designer support - do not modify
> /// the contents of this method with the code editor.
> /// </summary>
> private void InitializeComponent()
> {
> this.gradientPanel1 = new com.KeyCentrix.UI.Common.GradientPanel();
> this.transparentGroupbox2 = new
> TransparentControls.TransparentGroupbox();
> this.transparentLabel4 = new
> TransparentControls.TransparentLabel();
> this.transparentLabel2 = new
> TransparentControls.TransparentLabel();
> this.transparentGroupbox1 = new
> TransparentControls.TransparentGroupbox();
> this.transparentLabel5 = new
> TransparentControls.TransparentLabel();
> this.transparentLabel1 = new
> TransparentControls.TransparentLabel();
> this.transparentPanel1 = new
> TransparentControls.TransparentPanel();
> this.transparentLabel3 = new
> TransparentControls.TransparentLabel();
> this.gradientPanel1.SuspendLayout();
> this.transparentGroupbox2.SuspendLayout();
> this.transparentGroupbox1.SuspendLayout();
> this.SuspendLayout();
> //
> // gradientPanel1
> //
> this.gradientPanel1.AltBackColor =
> System.Drawing.Color.FromArgb(((System.Byte)(64)),
> ((System.Byte)(64)), ((System.Byte)(0)));
> this.gradientPanel1.BackColor =
> System.Drawing.SystemColors.GrayText;
> this.gradientPanel1.Controls.Add(this.transparentGroupbox2);
> this.gradientPanel1.Controls.Add(this.transparentGroupbox1);
> this.gradientPanel1.Controls.Add(this.transparentPanel1);
> this.gradientPanel1.GradientAngle = 0F;
> this.gradientPanel1.Location = new System.Drawing.Point(28, 68);
> this.gradientPanel1.Name = "gradientPanel1";
> this.gradientPanel1.Size = new System.Drawing.Size(520, 384);
> this.gradientPanel1.TabIndex = 9;
> //
> // transparentGroupbox2
> //
> this.transparentGroupbox2.BackColor =
> System.Drawing.Color.Transparent;
> this.transparentGroupbox2.Controls.Add(this.transparentLabel4);
> this.transparentGroupbox2.Controls.Add(this.transparentLabel2);
> this.transparentGroupbox2.Location = new System.Drawing.Point(24,
> 44);
> this.transparentGroupbox2.Name = "transparentGroupbox2";
> this.transparentGroupbox2.TabIndex = 5;
> this.transparentGroupbox2.TabStop = false;
> this.transparentGroupbox2.Text = "transparentGroupbox2";
> //
> // transparentLabel4
> //
> this.transparentLabel4.BackColor =
> System.Drawing.Color.Transparent;
> this.transparentLabel4.Location = new System.Drawing.Point(40, 64);
> this.transparentLabel4.Name = "transparentLabel4";
> this.transparentLabel4.TabIndex = 1;
> this.transparentLabel4.Text = "transparentLabel4";
> //
> // transparentLabel2
> //
> this.transparentLabel2.BackColor =
> System.Drawing.Color.Transparent;
> this.transparentLabel2.Location = new System.Drawing.Point(28, 24);
> this.transparentLabel2.Name = "transparentLabel2";
> this.transparentLabel2.TabIndex = 0;
> this.transparentLabel2.Text = "transparentLabel2";
> //
> // transparentGroupbox1
> //
> this.transparentGroupbox1.BackColor =
> System.Drawing.Color.Transparent;
> this.transparentGroupbox1.Controls.Add(this.transparentLabel1);
> this.transparentGroupbox1.Location = new System.Drawing.Point(256,
> 40);
> this.transparentGroupbox1.Name = "transparentGroupbox1";
> this.transparentGroupbox1.TabIndex = 4;
> this.transparentGroupbox1.TabStop = false;
> this.transparentGroupbox1.Text = "transparentGroupbox1";
> //
> // transparentLabel5
> //
> this.transparentLabel5.BackColor =
> System.Drawing.Color.Transparent;
> this.transparentLabel5.Location = new System.Drawing.Point(0, 0);
> this.transparentLabel5.Name = "transparentLabel5";
> this.transparentLabel5.TabIndex = 0;
> //
> // transparentLabel1
> //
> this.transparentLabel1.BackColor =
> System.Drawing.Color.Transparent;
> this.transparentLabel1.Location = new System.Drawing.Point(-8, 24);
> this.transparentLabel1.Name = "transparentLabel1";
> this.transparentLabel1.TabIndex = 2;
> this.transparentLabel1.Text = "transparentLabel1";
> //
> // transparentPanel1
> //
> this.transparentPanel1.Location = new System.Drawing.Point(184,
> 184);
> this.transparentPanel1.Name = "transparentPanel1";
> this.transparentPanel1.TabIndex = 1;
> //
> // transparentLabel3
> //
> this.transparentLabel3.BackColor =
> System.Drawing.Color.Transparent;
> this.transparentLabel3.Location = new System.Drawing.Point(0, 0);
> this.transparentLabel3.Name = "transparentLabel3";
> this.transparentLabel3.TabIndex = 0;
> //
> // Form1
> //
> this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
> this.BackColor = System.Drawing.SystemColors.Desktop;
> this.ClientSize = new System.Drawing.Size(584, 490);
> this.Controls.Add(this.gradientPanel1);
> this.Name = "Form1";
> this.Text = "Form1";
> this.gradientPanel1.ResumeLayout(false);
> this.transparentGroupbox2.ResumeLayout(false);
> this.transparentGroupbox1.ResumeLayout(false);
> this.ResumeLayout(false);
>
> }
> #endregion
>
> /// <summary>
> /// The main entry point for the application.
> /// </summary>
> [STAThread]
> static void Main()
> {
> Application.Run(new Form1());
> }
> }
> }
>
> using System;
> using System.Collections;
> using System.ComponentModel;
> using System.Drawing;
> using System.Data;
> using System.Windows.Forms;
>
> namespace TransparentControls
> {
> /// <summary>
> /// Summary description for TransparentLabel.
> /// </summary>
> public class TransparentLabel : System.Windows.Forms.Label
> {
> /// <summary>
> /// Required designer variable.
> /// </summary>
> private System.ComponentModel.Container components = null;
>
> public TransparentLabel()
> {
> // This call is required by the Windows.Forms Form Designer.
> InitializeComponent();
> SetStyle(ControlStyles.SupportsTransparentBackColor,true);
> SetStyle(ControlStyles.DoubleBuffer, true);
> this.SetStyle(ControlStyles.AllPaintingInWmPaint |
> ControlStyles.SupportsTransparentBackColor,true);
> this.UpdateStyles();
> this.BackColor = Color.Transparent;
> }
>
>
> /// <summary>
> /// Clean up any resources being used.
> /// </summary>
> protected override void Dispose( bool disposing )
> {
> if( disposing )
> {
> if(components != null)
> {
> components.Dispose();
> }
> }
> base.Dispose( disposing );
> }
>
> protected override CreateParams CreateParams
> {
> get
> {
> CreateParams cp=base.CreateParams;
> cp.ExStyle|=0x00000020; //WS_EX_TRANSPARENT
> return cp;
> }
> }
>
> #region Component Designer generated code
> /// <summary>
> /// Required method for Designer support - do not modify
> /// the contents of this method with the code editor.
> /// </summary>
> private void InitializeComponent()
> {
> components = new System.ComponentModel.Container();
> }
> #endregion
> }
> }


Frank Hileman

11/25/2004 2:07:00 PM

0

I know you probably want to use controls, but if you draw graphical objects
directly on a single control, you can have all the transparency you want,
with no flickering. The particular combination you mention (groupbox, label,
background) would not be difficult.

For example:
http://weblogs.asp.net/frank_hileman/archive/2004/05/10/1...

Regards,
Frank Hileman

check out VG.net: http://www.vg...
Animated vector graphics system
Integrated Visual Studio .NET graphics editor

"Brandon" <brandonshuey@sbcglobal.net> wrote in message
news:fde65c94.0411241218.53e34b5e@posting.google.com...
>I have been struggling with this for awhile now and tried many
> approaches, I'm hoping someone out there can give me a hand.
>
> The problem is I want transparent controls (label, groupbox, etc) to
> paint on a gradient panel. The flickering come when I move a
> different window over my form and drag it away (quickly). I have
> implemented most of the commonly prescribed solutions but none solve
> the problem. Here is the one that I think performs the best. Can
> someone tell me if this is a problem with GDI+ or am I missing
> something.
>
> I'm using a transparent label in a transparent groupbox on a gradient
> form. The controls all are employing the following in their
> constructor:


brandonshuey

12/1/2004 8:43:00 PM

0

I think there must be a way to do this and let me explain my
assumptions. If I use Bob Powells example of the transparent panel
that paints the spiral (http://www.bobpowell.net/transco...)
--without the timer repaint-- I have no problems with repaint. It is
smooth and flicker free.

Now, if I use similar coding techniques on a Control I don't get the
same effect instead I have the flicker problem. Therefore, there must
be a difference in the "behind the scenes" code between
System.Windows.Forms.Control and System.Windows.Forms.Panel. What is
the Panel doing right that the Control is not doing? What do I need
to do to the Control to immitate the Panel?