Partager via


CMFCButton::SetMouseCursor

Sets the cursor image.

void SetMouseCursor(
   HCURSOR hcursor 
);

Parameters

  • [in] hcursor
    The handle of a cursor.

Remarks

Use this method to associate a cursor image, such as the hand cursor, with the button. The cursor is loaded from the application resources.

Example

The following example demonstrates how to use the SetMouseCursor method in the CMFCButton class. The example is part of the code in the New Controls sample.

   CMFCButton m_Button;


...


// int m_iCursor 
void CPage1::OnSetCursor()
{
    UpdateData();

    switch (m_iCursor)
    {
    case 0:
        m_Button.SetMouseCursor(NULL);
        break;

    case 1:
        m_Button.SetMouseCursorHand();
        break;

    case 2:
        m_Button.SetMouseCursor(AfxGetApp()->LoadCursor(IDC_CURSOR));
        break;
    }
}

Requirements

Header: afxbutton.h

See Also

Reference

CMFCButton Class

Hierarchy Chart

CMFCButton::SetMouseCursorHand