Resizing Elements by moving mouse
Hi @ all,
i want to resize 2 or more Elements if i´ve clicked the mouse button and moving the mosue to left or right between 2 controls like a SplitterControl.
I´ve tried it with getting the rect of both element and then change the attributs of the rect and work on with DeferWindowPos. This is to slow.
Then I try it with setWindowPos but here i get the error that the first control moves a bit to left then overlap with the second ctrl and that´s it.
Here is the code
Code:
m_wndContactView.GetWindowRect(&crContact); //Control 1
m_wndSubjectView.GetWindowRect(&crSubject); //Control 2
ScreenToClient(&crContact);
ScreenToClient(&crSubject);
if(point.x > m_noldCursorPos ) //m_noldCursorPos = vorherige Position des Cursors
{
nDiff = point.x - crContact.right;
m_wndContactView.SetWindowPos(NULL, crContact.left, crContact.top, crContact.Width() + nDiff, crContact.Height(), SWP_NOZORDER);
m_wndSubjectView.SetWindowPos(NULL, crSubject.left + nDiff, crSubject.top, crSubject.Width() - nDiff, crContact.Height(), SWP_NOZORDER);
Invalidate(FALSE); //Bereits mit TRUE probiert
}
I don´t know on!
Regards
Karsten