views:

34

answers:

2

I have a VB .NET form with a splitter control on it, and I want to save its position between program runs. I am currently handling the SplitterMoved event and storing the SplitterDistance. Then on program startup, I set the SplitterDistance to the saved value.

However, sometimes the program resizes the splitter, raising the SplitterMoved event and overwriting my saved distance. I have several splitters over multiple tabs in a tab control, and any time the user goes to a new tab for the first time, the SplitterMoved event fires.

Is there an event I can use that will only fire when the user moves the splitter, and not when the program moves the splitter? I tried MouseUp, but when that event fires, the new SplitterDistance is not yet set.

A: 

No, there isn't a separate event as the splitter has been moved.

Given that the spliter should be in the same place as it was before it shouldn't change the value you have stored. Are you checking the sender object to make sure you're updating the correct splitter position?

ChrisF
A: 

The SplitterEventArgs provide both the splitter coordinates and the mouse coordinates.

I'd assume that for non-user instigated SplitterMoved events, the Mouse coordinates would be out of range.

James Curran