Hello,
I want to draw nice splitter in splitContainer. To do this, I call method below in splitContainer1_Paint event.
private void splitContainer1_Paint(object sender, PaintEventArgs e){
ProfessionalColorTable pct = new ProfessionalColorTable(); Rectangle bounds = (sender as SplitContainer).SplitterRectangle;// Make sure we need to do work if ((bounds.Width > 0) && (bounds.Height > 0))
{
Graphics g = e.Graphics; // Setup colors from the provided renderer Color begin = pct.OverflowButtonGradientMiddle; Color end = pct.OverflowButtonGradientEnd; // Make sure we need to do work using (Brush b = new LinearGradientBrush(bounds, begin, end, LinearGradientMode.Vertical)){
g.FillRectangle(b, bounds);
}
}
}
The I resize a form, splitter disappears or redraws incorectlly. Any sugestions

splitContainer problem/bug in .NET 2
shakalama
Hi,
I can't reproduce this on my system, but try invalidating SplitContainer on resize:
private void splitContainer1_Resize(object sender, EventArgs e){
splitContainer1.Invalidate();
}
Andrej
DragonC#
Ntc
txteacher
Still haven't received your mail... Could you check if it went through
Update: ooops, sorry, hotmail marked it as junk... got it.
Andrej
Io2006
clstephenson
I really can't make the splitter behave like you're describing... Maybe it's some other control / form property causing this... You can try setting form's DoubleBuffered property to true, but I'm not sure it will help.
Andrej
jus
How do you have your form set up Is SplitContainer docked in the form or in some other control
Nanja Raje Urs
Sadly...
Thead is left open for any other suggestion.
If no - have to wait for service pack 1. :) Dam, Microsoft...
Travis75
Ok, here's what's happening... I run your project and it behaved like you described... Then I added your form to my project - and it works fine... Investigating further...
Andrej
Sarath.
Oh no... looks like you were right, this might be due some painting bug :)
I noticed that splitter paints correctly only, if the the form that's hosting it, is shown using ShowDialog() method.
If form is invoked on startup (Application.Run(new Form1());) or with Show() method, the splitter doesn't always paint correctly. So invalidating it would be the only solution here. Now I'm out of ideas :)
Andrej
anubisascends
Valery Zharkov
It works, but Pain event is call many times and my computer's processor is load ~60% to when resizing!
I have looked for solution, but till not haven't found any. :(
nicola_italia
Ravel
You can send it on my mail: /deleted/.
Andrej