OnPaint troubles.

  • Thread starter Thread starter Vladimir Bezugliy
  • Start date Start date
V

Vladimir Bezugliy

I inherit my control from Splitter.

I overrided next function:
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
Graphics g = e.Graphics;

using(Brush b = new SolidBrush(Color.DarkBlue))
{
Rectangle rec = e.ClipRectangle;
g.FillRectangle(
b, rec.Right/2-15, rec.Top, 30, rec.Bottom-rec.Top);
}
}

But it does not work properly.
Look of my splitter do not changes(painted rectangle does not change
it's position) if I change size of my form with splitter.
Splitter repainted only if I switch to another program and go back to my
application.
What wrong?
 
Try adding an event handler to the SplitterMoved/SplitterMoving events, and
call Invalidate to force a redraw.
 
Back
Top