Hello Steve,
In products like the new version of Outlook the splitter bars contain a
series of 'dots' in the middle to indicate and highlight the splitter bar.
I
see this is not available using the SplitContainer control in Visual
Studio.
Is it possible to draw these 'dots' on the splitter bar? I have tried
numerous methods but cannot get it to work. Any help much appreciated.
So, after a bit of a discussion in this thread, I had a closer look at
things. To my surprise I found that it's really easy to do this - I was
confused by some previous experience that obviously wasn't really related
to this issue and by the fact that you say you tried numerous methods
without success. So here's how you can do it:
* Drop a SplitContainer on a form
* Set the SplitterWidth property on the container to 10, this will make things easier to see.
* Create an event handler for the Paint event of the container. Careful: you want the event handler for the container, not that for any one of the two panels inside it. Make sure to select the complete container before you add the handler.
* Add the following code to the event handler:
Rectangle rect = splitContainer1.SplitterRectangle;
int middleY = rect.Y + rect.Height / 2;
int middleX = rect.X + rect.Width / 2;
e.Graphics.DrawLine(Pens.Red,
middleX, middleY - 5, middleX, middleY + 5);
Of course this is an extremely simple example - it simply draws a line in
the middle of the splitter area, it makes sense only with vertical
splitters and so on. You'll have to make it more flexible for your purposes.
Now, I was going to implement some "dot drawing" like you say Outlook
does, but looking at my Outlook (2007) I don't see any such dots on any
splitters. I thought I knew what you meant because I've seen similar
splitter visualization in other apps in the past, but Outlook doesn't seem
to do it - maybe it's because I'm running on Vista, where the drawing may
be slightly different to other Windows versions.
Oliver Sturm