WinForms: Alternative to SplitContainer?

Telanor picture Telanor · Apr 23, 2010 · Viewed 13.9k times · Source

Are there any alternative controls someone can suggest to replace the WinForms SplitContainer? I don't like how the SplitContainer shows that weird, dotted strip when its selected and when its being dragged. I want to have the panels re-size as the user drags instead of on mouse up and not show any dotted strips when the splitter is being dragged. Basically like how all the re-sizing of panels is done in windows explorer on vista.

This is the dotted thing I'm talking about:

splitter
(source: bhslaughter.com)

Answer

MusiGenesis picture MusiGenesis · Apr 23, 2010

Write your own split container UserControl. You basically just drop two Panels onto the control (for the left and right panels) and then let the space between them be the splitter. A little MouseDown, MouseMove and MouseUp logic on the UserControl itself will let you easily move the "splitter" left and right, and the two panels will properly block this everywhere but over the splitter, so your logic for checking if the mouse if over the splitter is as simple as can be.

It may be a little extra work getting the control to act the way you want it to act in design mode.