Y'herd thisun? 

“Seen the funny and GREAT movie "the Big Dish?" Heading to Cali for a vaca? You have to visit the Goldstone array complex. Check this to see why”

from Visit to Goldstone by Smith

Where's the winform splitter?

TaggedCoding, DotNet

The XP GUI flat style (some call it the Retro-Apple style) is neat and clean.

The splitter control is a nice addition.

But together, they can be annoying to the users ... at first.

The splitter offers three border styles: "None", "FixedSingle" (draws a line around the rectangle) and "Fixed3D." Problem is that the 3d option does what most of us feel is the opposite of what we need, it insets rather than popping up.

There's a very simple way to get the raised look that you need ... just override the painting of the splitter.

Start a new VB7 project using the "Windows Control Library" template. Change the name of the project to "svEnhancedSplitter" (or whatever name you'd prefer)

When C# is done wizarding the basic files, rightclick on the "UserControl1.vb" node on the project tree and choose "Delete" (this is the easy way to start off fresh). Then rightclick on the Project node and choose "Add >> Add UserControl." Making sure that the template is set to "User Control" give the new file a name (I'll use "svEnhancedSplitter.vb" and change the Namespace later).

Now, doubleclick on the usercontrol designer or click on the "svEnhancedSplitter.vb" tab on the work area to bring up the code view. Change the Inheritance from "System.Windows.Forms.UserControl" to "System.Windows.Forms.Splitter"

Pull down the Class Name combo and click on Base Class Events.

Pull down the Method Name combo and click on Paint.

Fill in the stub as shown below.

Now you've only to build this project. Once referenced in any other project you can drag your new splitter from the toolbox to a form and have the raised look. There's no need to put a wrapper on your old Sheridan control after all :)

Hope that helps.

Robert Smith, Kirkland, WA

home     who is smith    contact smith     rss feed π
Since 1997 a place for my stuff, and it if helps you too then all the better