How to apply a Hand cursor to a Picture box
-
Hi How to apply a Hand cursor to a Picture box and its member variable is a CStatic control. Whenever i moved cursor on to that picture box it should display Hand cursor. My application is SDI application in which CView class is derived from CFormView. I have tried in this way but didn't get plz help me. m_Image.SetCursor(::LoadCursor(NULL,IDC_HAND)); //here IDC_HAND is not working i have given IDC_HELP. Where should i use this code in View class to display that cursor. Help me.
-
Hi How to apply a Hand cursor to a Picture box and its member variable is a CStatic control. Whenever i moved cursor on to that picture box it should display Hand cursor. My application is SDI application in which CView class is derived from CFormView. I have tried in this way but didn't get plz help me. m_Image.SetCursor(::LoadCursor(NULL,IDC_HAND)); //here IDC_HAND is not working i have given IDC_HELP. Where should i use this code in View class to display that cursor. Help me.
I think (I'm not sure), you have to activate the notify style of the CStatic (in the properties of the control). Then, go in the class wizzard and add a handler for the mouse move event of your control (it must have an ID different than IDC_STATIC). This handler function is in the view class. Then add your code for loading the cursor in this function.
-
Hi How to apply a Hand cursor to a Picture box and its member variable is a CStatic control. Whenever i moved cursor on to that picture box it should display Hand cursor. My application is SDI application in which CView class is derived from CFormView. I have tried in this way but didn't get plz help me. m_Image.SetCursor(::LoadCursor(NULL,IDC_HAND)); //here IDC_HAND is not working i have given IDC_HELP. Where should i use this code in View class to display that cursor. Help me.
Hi, Assume
CYourControl
is the class implementing your image or whatever you are using, andTheParent
is the class corresponding to the host of your control. Write the following code within the handler responding to the WM_SETCURSOR event:BOOL TheParent::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
// TODO: Add your message handler code here and/or call default
CYourControl *pYC = ...... // get here the pointer to your controlif ( pYC ) { if ( pWnd == pYC ) { SetCursor(LoadCursor(NULL,IDC\_YOUR\_CURSOR)); return TRUE; } } return TheParentBaseClass::OnSetCursor(pWnd, nHitTest, message);
}
IDC_HAND Windows is defined for NT 5.0 and later. You can create your own cursor. Do not forget that line returning TRUE! SkyWalker -- modified at 3:38 Friday 21st October, 2005
-
Hi, Assume
CYourControl
is the class implementing your image or whatever you are using, andTheParent
is the class corresponding to the host of your control. Write the following code within the handler responding to the WM_SETCURSOR event:BOOL TheParent::OnSetCursor(CWnd* pWnd, UINT nHitTest, UINT message)
{
// TODO: Add your message handler code here and/or call default
CYourControl *pYC = ...... // get here the pointer to your controlif ( pYC ) { if ( pWnd == pYC ) { SetCursor(LoadCursor(NULL,IDC\_YOUR\_CURSOR)); return TRUE; } } return TheParentBaseClass::OnSetCursor(pWnd, nHitTest, message);
}
IDC_HAND Windows is defined for NT 5.0 and later. You can create your own cursor. Do not forget that line returning TRUE! SkyWalker -- modified at 3:38 Friday 21st October, 2005
nice mircea, and do u think, an else part is needed? i'm not sure. but luking at ut code, if ( pWnd == pYC ) { SetCursor(LoadCursor(NULL,IDC_YOUR_CURSOR)); return TRUE; } /* else // not needed? { SetCursor(LoadCursor(NULL,IDC_ARROW)); return TRUE; } */ if this sets changes the cursor the first time, then if we move on to the next control will this cursor stay in the same IDC_YOUR_CURSOR? dont it need to change to IDC_IDC_ARROW? plz teach me :) He is like a one-legged man in a bum kicking competition. -Novjot Sidhu --[v]--
-
nice mircea, and do u think, an else part is needed? i'm not sure. but luking at ut code, if ( pWnd == pYC ) { SetCursor(LoadCursor(NULL,IDC_YOUR_CURSOR)); return TRUE; } /* else // not needed? { SetCursor(LoadCursor(NULL,IDC_ARROW)); return TRUE; } */ if this sets changes the cursor the first time, then if we move on to the next control will this cursor stay in the same IDC_YOUR_CURSOR? dont it need to change to IDC_IDC_ARROW? plz teach me :) He is like a one-legged man in a bum kicking competition. -Novjot Sidhu --[v]--
Hi, I send you by e-mail the same coding example I sent to snprani. Ok? SkyWalker
-
Hi, I send you by e-mail the same coding example I sent to snprani. Ok? SkyWalker
-
thank u so much. He is like a one-legged man in a bum kicking competition. -Novjot Sidhu --[v]--
You are welcome :-) SkyWalker