VC++6 mfc problem
怎样用VC++6 MFC 编的应用程序中使鼠标光标变成自绘的位图形状
我用LoadCursor()和SetCursor()函数却使光标变没了
问题点数:20、回复次数:7Top
1 楼kensmile(ken)回复于 2002-09-14 19:06:41 得分 0
你的位图的尺寸,或是格式完全符合cursor的要求么。Top
2 楼everandforever(Forever)回复于 2002-09-14 19:08:22 得分 10
位图?ICON才对吧。Top
3 楼kaola103(kaola)回复于 2002-09-14 21:01:58 得分 0
我把它改成ico格式了 尺寸是16*16的,但都不行Top
4 楼everandforever(Forever)回复于 2002-09-14 22:54:08 得分 0
代码贴来看看。Top
5 楼ttzzgg_80713(身无立锥地,常有四海心---老子有条命)回复于 2002-09-14 22:58:26 得分 0
LoadCursor失败了吧Top
6 楼tbs610(NWLi)回复于 2002-09-14 23:53:20 得分 10
kaola103(kaola) :“我把它改成ico格式了 尺寸是16*16的,但都不行”
你是怎么改成icon的,是直接改扩展名吗?那样不行,最好用个专门的转换软件!!Top
7 楼kaola103(kaola)回复于 2002-09-15 08:57:16 得分 0
// wuView.cpp : implementation of the CWuView class
CWuView::CWuView()
{
// TODO: add construction code here
m_cursor=(HCURSOR)(AfxGetApp()->LoadIcon(IDB_BITMAP1));
}
void CWuView::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
::SetCursor(m_cursor);
CView::OnMouseMove(nFlags, point);
}
我还有一个问题不明白:
void CWuView::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
::SetCursor(m_cursor);
if(black_white){
if(point.x>100&&point.x<350&&point.y>20&&point.y<270){
h=(int)((point.x-95)/20);z=(int)((point.y-15)/20);
if(gamedata[h][z]==0){
gamedata[h][z]=1;
for(int i=0;i<7;i++){
CClientDC cdc(this);
cdc.Ellipse(h*20+105-7+i,z*20+25-7+i,h*20+105+7-i,z*20+25+7-i);
}
black_white=FALSE;
}
}
}
if(!black_white){
if(point.x>100&&point.x<350&&point.y>20&&point.y<270){
h=(point.x-95)/20;z=(point.y-15)/20;
if(gamedata[h][z]==0){
gamedata[h][z]=2;
CClientDC cdc(this);
cdc.Ellipse(h*20+105-7,z*20+25-7,h*20+105+7,z*20+25+7);
black_white=TRUE;
}
}
}
CView::OnLButtonDown(nFlags, point);
}
void CWuView::OnLButtonUp(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
::SetCursor(m_cursor);
CView::OnLButtonUp(nFlags, point);
}
这是使鼠标在一个(100,20,350,270)的正方形内按下时绘制圆形,但为什么却画不出来。
Top




