Possible to determine which edge is being used to resize window?

Is it possible to determine which edge is being used (dragged) to resize a window?

I have two controls side by side on a window. If the left edge is used to make the window wider, I want the left control to grow wider and the right control to not change width. And the opposite if the right edge is used.

I think I can make this work by manipulating the LockLeft and LockRight properties of the controls but I need to know which side is being used (dragged) to resize the window.

Unfortunately, MouseDown doesn’t register a coordinate if the edge is clicked on and dragged.

Any ideas or suggestions would be appreciated. Thanks!

Save the Self.Left value & compare it in the resized or resizing events.

Thanks. That pointed me in the correct direction. It turned out to be a bit more complicated than I expected and I had to ‘clean-up’ the controls sizes/locations after the resizing because of some random shifting that happens.

Attached is my test project.

resizing.zip (5.3 KB)

I’ve been trying to figure how to eliminate the slight random movement of the non-moving side of the controls - it typically happens to the inner sides of the controls but once in awhile affects an outer side of one of the controls.

I’m assuming its unavoidable - reflecting the default ‘locked’ properties of the controls before the Resizing event code executes to ‘unlock’ the side of the control on the opposite side of the movement.

Just wondering if anyone has any suggestions? Thanks!

Updated example project showing the issue:

resizing.zip (5.8 KB)

I guess with your approach, as you mention the current locks can get hold of a control before they are getting changed, and the order of events is sometimes not easy to follow as move can mean resize too but will be followed by a resized event …

Considering that idea, how about changing the locks earlier and trusting OS resize fully? With that code in LBLeft:

Sub FocusReceived() Handles FocusReceived
  Me.LockRight = False
  lbRIGHT.LockLeft = True
End Sub

and a similar in LBRight.FocusReceived, I could remove all window events and buffer properties and see no jumping edges anymore.

EDIT: Oh sorry, I see you want to change according to window side change, while when testing I got the idea you wanted to change according to the control focus. So ignore my idea – although I still think it should be possible to set the locks somewhat earlier …