How to change cursor?
-
I want to change cursor icon when cursor is over a button or other control. But what events have to handle when cursor come in the client area of the control and when it go out of client area? thanks
-
I want to change cursor icon when cursor is over a button or other control. But what events have to handle when cursor come in the client area of the control and when it go out of client area? thanks
void CMyApp::OnLButtonDown() { AfxGetApp()->DoWaitCursor(1); // 1->>display the hourglass cursor // do some lengthy processing AfxGetApp()->DoWaitCursor(-1); // -1->>remove the hourglass cursor } What you are talking about, you might have to deal with CPoint. Use CPoint to get the location of the cursor in accordance to the location of the window. When the cursor is at a certain location in the window, such as, over a button. . .an action takes place to change the cursor. I know ActiveX controls have this ability. Chech them out.
-
I want to change cursor icon when cursor is over a button or other control. But what events have to handle when cursor come in the client area of the control and when it go out of client area? thanks
void CMyApp::OnLButtonDown() { AfxGetApp()->DoWaitCursor(1); // 1->>display the hourglass cursor // do some lengthy processing AfxGetApp()->DoWaitCursor(-1); // -1->>remove the hourglass cursor } What you are talking about, you might have to deal with CPoint. Use CPoint to get the location of the cursor in accordance to the location of the window. When the cursor is at a certain location in the window, such as, over a button. . .an action takes place to change the cursor. I know ActiveX controls have this ability. Check them out.
-
I want to change cursor icon when cursor is over a button or other control. But what events have to handle when cursor come in the client area of the control and when it go out of client area? thanks
Use the mouse move message to check whether the cursor is in the area of a control. For example, if you are using MFC, trap the
ON_WM_MOUSEMOVE
message and in theOnMouseMove
message-handler, find theCRect
area of the control (such as button) using functions such asGetDlgItem
,GetWindowRect
andScreenToClient
. And, then use the set cursor message (such asON_WM_SETCURSOR
) and in its handler, first check whether the cursor point is in the aforesaidCRect
area of the specific control and if so, useSetCursor
function to change the cursor. Regards, Ashok Dhamija _____________________________ Padam Technologies