Create a button that can be dragged and dropped??
-
Hi, There is no direct method available for this.. You can follow the following steps. Assumption: Parent window and children to be draged already created You need to handle three mouse events.. WM_LBUTTONDOWN, WM_MOUSEMOVE, WM_LBUTTONUP 1. In the WM_LBUTTONDOWN message, call the SetCapture function with the control ID 2. In the WM_MOUSEMOVE message, call the GetCapture method and check the returned Window handle againt the your window child control window handle. If both are same, call SetWindowPos() to set the control new position. 3. In the WM_LBUTTONUP, check for the GetCapture() returned window handle is equal to your window control handle. If it is call ReleaseCapture() method, and once again place the window control by using SetWindowPos(). One more thing you have to take care is , when user clicks the button, he can drag that button out of parent window. To avoid such a situation, call the ClipCursor() function with the parent window rectangle size values...Then don't forgot to free the cursor. That you can do it by ClipCursor(NULL).. Enjoy programming... " Action without vision is only passing time, Vision without action is merely day dreaming, But vision with action can change the world " - Words from Nelson Mandela Thanks & Regards, Gopalakrishnan
-
Hi, There is no direct method available for this.. You can follow the following steps. Assumption: Parent window and children to be draged already created You need to handle three mouse events.. WM_LBUTTONDOWN, WM_MOUSEMOVE, WM_LBUTTONUP 1. In the WM_LBUTTONDOWN message, call the SetCapture function with the control ID 2. In the WM_MOUSEMOVE message, call the GetCapture method and check the returned Window handle againt the your window child control window handle. If both are same, call SetWindowPos() to set the control new position. 3. In the WM_LBUTTONUP, check for the GetCapture() returned window handle is equal to your window control handle. If it is call ReleaseCapture() method, and once again place the window control by using SetWindowPos(). One more thing you have to take care is , when user clicks the button, he can drag that button out of parent window. To avoid such a situation, call the ClipCursor() function with the parent window rectangle size values...Then don't forgot to free the cursor. That you can do it by ClipCursor(NULL).. Enjoy programming... " Action without vision is only passing time, Vision without action is merely day dreaming, But vision with action can change the world " - Words from Nelson Mandela Thanks & Regards, Gopalakrishnan
-
Thanks! But can this be done using OLE drag and drop? If so, how do I do it? Can't seem to find any good information of how to drag Controls. Thanks!
No. You cannot.. " Action without vision is only passing time, Vision without action is merely day dreaming, But vision with action can change the world " - Words from Nelson Mandela Thanks & Regards, Gopalakrishnan