I have a CView
that acts as a placeholder for several Ctrl's stacked vertically so as the occupy all available space. What I wish to do is grab a horizontal boundary with the mouse and drag it up or down to resize Ctrl height.
The problem being that the child Ctrl's of the CView
intercept the mouse messages and not the CView
parent window (WM_LBUTTONDOWN
, WM_MOUSEMOVE
etc). The Ctrl's also handle these messages for unrelated editing requirements.
Would anyone be able to offer advice or supply a reference to possible solution(s) to this sizing/editing requirement. The situation is some what similar to the resource editor in Visual Studio. Only I wish to edit in a live environment.
I think this could easily be done as follows:
Leave a small gap between the child controls (say 2 or 3 pixels). This could be drawn in the same color, or a slightly different shade.
Set the cursor to
IDC_SIZENS
for the main CView.Handle the mouse messages (when the mouse is over that gap) in the main CView (down, move, ..).
On 'dragging' resize the child controls.
That way all messages would still go to te child controls, except when the mouse is above those 2 to 3 pixel 'splitters'.
If leaving a small gap is really no option, than you would have to capture all mouse messages in the CView and check if they are on a border. If not, forward (or default) them to the child window below the mouse cursor.