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?
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.
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
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.
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.