Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / January 2007

Tip: Looking for answers? Try searching our database.

SplitContainer

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Steve Randall - 29 Jan 2007 10:19 GMT
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.

Cheers.
Oliver Sturm - 29 Jan 2007 19:43 GMT
Hello Steve,

>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.

I don't think it can easily be done with the standard splitter control. Of
course you could create your own and do what you want... :-)

               Oliver Sturm
Signature

http://www.sturmnet.org/blog

ClayB - 30 Jan 2007 11:18 GMT
One thing you can try is to derive the Splitter class and override
OnPaint. There you can draw whatever you want to draw.

   public class MySplitter : Splitter
   {
       protected override void OnPaint(PaintEventArgs e)
       {
           base.OnPaint(e);
           Rectangle rect = this.ClientRectangle;
           rect.Y = rect.Y + rect.Height / 2 - 4;
           rect.Height = 8;
           e.Graphics.FillRectangle(Brushes.Pink, rect);
       }
   }
=======================
Clay Burch
Syncfusion, Inc.
Oliver Sturm - 30 Jan 2007 12:05 GMT
Hello ClayB,

>One thing you can try is to derive the Splitter class and override
>OnPaint. There you can draw whatever you want to draw.

True of course, maybe I should have had a closer look - but even though my
post mentioned the "splitter control", we were really talking about the
SplitContainer, and I believe this control doesn't allow easy access to
the relevant paint events. If I'm wrong - sorry for not looking into more
detail at this time.

               Oliver Sturm
Signature

http://www.sturmnet.org/blog

Oliver Sturm - 30 Jan 2007 16:38 GMT
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.
[quoted text clipped - 4 lines]
>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
Signature

http://www.sturmnet.org/blog


Rate this thread:







Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.