4

I created a Winform in VB.NET, and I added a Splitter control to allow resizing of panels during runtime.

My issue is that the splitter control is not apparent. I would like to make it appear in a way that the user would know the form can be resized. At the moment, I basically just changed the color, but I don't like how that looks.

Can anyone tell me the proper way to use this control, so that users will understand immediately that the panels are resizable?

Joel Coehoorn
  • 399,467
  • 113
  • 570
  • 794
jgallant
  • 11,143
  • 1
  • 38
  • 72

4 Answers4

7

I was just about to suggest the border trick (that you posted yourself). Another thing that I usually do is that I hook up event handler for the MouseEnter and MouseLeave events for the Splitter control, and add this code there:

private void Splitter_MouseEnter(object sender, EventArgs e)
{
    ((Splitter)sender).BackColor = SystemColors.ControlDark;
}

private void Splitter_MouseLeave(object sender, EventArgs e)
{
    ((Splitter)sender).BackColor = SystemColors.Control;
}

That way the Splitter "lights up" (or rather, shadows down...) when the mouse passes it, drawing attention to that there is a control that you can interact with there.

Fredrik Mörk
  • 155,851
  • 29
  • 291
  • 343
  • Thanks for the tip. I have added this to my code, and it does improve the usability from my perspective. – jgallant May 26 '09 at 13:43
0

I like deriving the control so I can make all the splitters work the same. Adding the property makes it work a little nicer with the IDE so the coder can change it at design time.

Public Class HighlightSplitContainer
    Inherits SplitContainer

    Property HighlightColor As Color = SystemColors.ControlDark

    Protected Overrides Sub OnMouseEnter(e As System.EventArgs)
        BackColor = HighlightColor
        MyBase.OnMouseEnter(e)
    End Sub

    Protected Overrides Sub OnMouseLeave(e As System.EventArgs)
        BackColor = SystemColors.Control
        MyBase.OnMouseLeave(e)
    End Sub
End Class
Hucker
  • 671
  • 1
  • 8
  • 25
0

Okay,

I guess if I set the Panels to have a border, it looks like the panels can resize.

I didn't have a border set, therefore the splitter was not visible.

jgallant
  • 11,143
  • 1
  • 38
  • 72
0

You can set the SplitterWidth property to a greater value to make it more visible.

You could also change the mouse cursor when the mouse is over the Splitter control. A similar idea is to show a tooltiptext when the mouse is over the control.

Meta-Knight
  • 17,626
  • 1
  • 48
  • 58