Re: Flickering of gradient rectangle



Hello,

Although you set the doublebuffer for your form, you didn't do for the panel
control...Simply derive a control from Panel setting those doublebuffer
flags and use this control to draw your gradient...

Hope it helps...

Özden

"LightWarrior" <ms@xxxxxxxx> wrote in message
news:1154677954.411357.194780@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
Hello,

I created an panel in my form. In the Paint event of this panel I
created a gradient rectangle...
Like you can see in this code:

Rectangle rect = new Rectangle(0, 0, this.panel1.Width,
this.panel1.Height);

LinearGradientBrush m_brush = new LinearGradientBrush(rect,
SystemColors.Highlight, SystemColors.GradientInactiveCaption,
LinearGradientMode.ForwardDiagonal);

e.Graphics.FillRectangle(m_brush, rect);

PointF left = new PointF(0, this.panel1.Height - 1);
PointF right = new PointF(this.panel1.Width, this.panel1.Height - 1);

e.Graphics.DrawLine(SystemPens.ControlLightLight, left, right);

In the form constructur I already set these styles:
SetStyle(ControlStyles.UserPaint |
ControlStyles.AllPaintingInWmPaint |
ControlStyles.DoubleBuffer, true);
UpdateStyles();

The problem is that when I resize the window (in my test app the panel
is docked in the form) the gradient rectangle is flickering. What I
want is a rectangle that is resizing when I resize my form. But without
flickering...

Can somebody help me!?

Greetings!
LW



.



Relevant Pages

  • Re: Seeking hints on building a control panel ...
    ... my panel fed through an appropiately wired pair of diodes. ... LGB auxiliary contacts added to the EPL turnout motors to cut-off power to ... 4-6-0 pilot trucks to track through the spring switches reliably. ... and mounted my control toggle switches and pushbuttons to that surface. ...
    (rec.models.railroad)
  • Re: regional setting
    ... account has the symptoms of not allowing regional setting via the control ... panel GUI interface. ... This ensures that the date separator and the date format are ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: Video adapter question second try. Dual monitor
    ... That is why the Display control panel will have a "force detection" ... I have a Dell 9300 with an ATI Mobility Radeon X300 video card. ... be a separate driver file and a separate CCC file, ...
    (alt.comp.hardware.pc-homebuilt)
  • Re: Receiver Control Panel
    ... >> is slightly separated from where the receiver case itself would sit. ... My thought is that the control panel probably has ... > up enough extra for each pot so that you can wrap the entire pot casing. ...
    (sci.electronics.repair)
  • Re: Removing all traces of MS-Office (versions 2K and XP)
    ... I found out how to remove Office XP via the Control ... Control Panel and then reinstall it. ... >Description of the Windows Installer CleanUp Utility ... >| Applications does show Excel/Word starting, ...
    (microsoft.public.office.setup)

Loading