L
LightWarrior
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
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