Click to See Complete Forum and Search --> : Resizing Elements by moving mouse


CrazyPlaya
May 12th, 2009, 08:49 AM
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

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