Saturday, November 21, 2009

How to Change Cursor in VC++? Different Type of Cursor

*.header

public:
bool c1,c2,c3,c4;

*.cpp

void CCursor1View::OnMouseMove(UINT nFlags, CPoint point)
{

if(c1)
{
::SetCursor (::LoadCursor (NULL,IDC_CROSS));
}
else if(c2)
{
::SetCursor(::LoadCursor (NULL,IDC_APPSTARTING));
}
else if(c3)
{
::SetCursor (::LoadCursor (NULL,IDC_HELP));
}
else if(c4)
{
::SetCursor (::LoadCursor (NULL,IDC_WAIT));
}

}


void CCursor1View::OnMouseeventCross()
{
// TODO: Add your command handler code here

c1=true;
c2=false;
c3=false;
c4=false;

}

void CCursor1View::OnMouseeventAppstarting()
{
// TODO: Add your command handler code here
c1=false;
c2=true;
c3=false;
c4=false;


}

void CCursor1View::OnMouseeventHelp()
{
// TODO: Add your command handler code here
c1=false;
c2=false;
c3=true;
c4=false;

}

void CCursor1View::OnMouseeventWait()
{
// TODO: Add your command handler code here
c1=false;
c2=false;
c3=false;
c4=true;


}


you can also select this cursor:

1.IDC_APPSTARTING
2.IDC_ARROW
3.IDC_CROSS
4.IDC_HAND
5.IDC_HELP
6.IDC_ICON
7.IDC_NO
8.IDC_SIZE
9.IDC_SIZEALL
10.IDC_SIZENESW
11.IDC_SIZENS
12.IDC_SIZENWSE
13.IDC_SIZEWE
14.IDC_UPARROW
15.IDC_WAIT

No comments:

Post a Comment