Hi, Your fix mentioned in the response to Luc prompted me to look into this again. I'd given up once before as I had got nowhere fast. The trick is to disable the default handling of the splitter by cancelling the SplitterMoving event. Once that is done the splitter position can be set explicitly in the MouseMove event. Redrawing is automatic and no invalidation is required. This is what I have
private Boolean mouseDown = false;
....
splitContainer.MouseMove += SplitContainer_MouseMove;
splitContainer.MouseDown += SplitContainer_MouseDown;
splitContainer.MouseUp += SplitContainer_MouseUp;
splitContainer.SplitterMoving += SplitContainer_SplitterMoving;
....
private void SplitContainer_MouseDown(object sender, MouseEventArgs e) {
mouseDown = true;
}
private void SplitContainer_MouseUp(object sender, MouseEventArgs e) {
mouseDown = false;
}
private void SplitContainer_SplitterMoving(object sender, SplitterCancelEventArgs e) {
// prevent default action
e.Cancel = true;
}
private void SplitContainer_MouseMove(object sender, MouseEventArgs e) {
SplitContainer sc = (SplitContainer)sender;
if (mouseDown) {
if (sc.Orientation == Orientation.Horizontal) {
if (e.Y >= 0) {
sc.SplitterDistance = e.Y;
}
} else {
if (e.X >= 0) {
sc.SplitterDistance = e.X;
}
}
}
}
Alan.