程序如下执行以下的程序后程序的速度渐渐变慢可用内存数量越来越少
void CSmallView::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CRect tt;
CDC *pDC1=this->GetDC();
GetClientRect(tt);
tt.bottom=tt.bottom/0.3;
tt.right=tt.right/0.3;
pDC1->SetMapMode(MM_ANISOTROPIC);
pDC1->SetViewportExt(pDC1->GetDeviceCaps(LOGPIXELSX)*0.4,
pDC1->GetDeviceCaps(LOGPIXELSY)*0.4);
pDC1->SetWindowExt(100, 100);
pDC1->DPtoLP(&point,1);
if(pressflag){
CSize offset(point-firstpoint);
four[0]=four[0]+offset;
//four[1]=four[1]+offset;
//four[2]=four[2]+offset;
//four[3]=four[3]+offset;
firstpoint=point;
OnPaint1(doc,view);
view->refresh(four[0].x,four[0].y); }
CDialog::OnMouseMove(nFlags, point);
}
后来发现是CDC *pDC=this->GetDC()的原因这是怎么回事怎么解决?
void CSmallView::OnMouseMove(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
CRect tt;
CDC *pDC1=this->GetDC();
GetClientRect(tt);
tt.bottom=tt.bottom/0.3;
tt.right=tt.right/0.3;
pDC1->SetMapMode(MM_ANISOTROPIC);
pDC1->SetViewportExt(pDC1->GetDeviceCaps(LOGPIXELSX)*0.4,
pDC1->GetDeviceCaps(LOGPIXELSY)*0.4);
pDC1->SetWindowExt(100, 100);
pDC1->DPtoLP(&point,1);
if(pressflag){
CSize offset(point-firstpoint);
four[0]=four[0]+offset;
//four[1]=four[1]+offset;
//four[2]=four[2]+offset;
//four[3]=four[3]+offset;
firstpoint=point;
OnPaint1(doc,view);
view->refresh(four[0].x,four[0].y); }
CDialog::OnMouseMove(nFlags, point);
}
后来发现是CDC *pDC=this->GetDC()的原因这是怎么回事怎么解决?
解决方案 »
- runtime error r6002,floating point not loaded
- Windows安装的MSXML解析器,就是一个dll文件? 包含了一些xml处理函数?
- MSXML实现载入XML到树形控件的问题
- MFC程序+SQL server2000数据库的管理系统。想将程序转移到另一台机子运行该如何做呢?
- (在线等,解决就结分)如何区分我的电脑里的盘符对应的是硬盘还是u盘
- 关与tree控件的问题
- 郁闷啊,谁能给我这样一个算法?
- c语言查找连续相同的字符?
- MFC程序中的各个类的互访?
- AES加密算法,有时结果对,有时不对(不能解密),大家帮忙给看看!
- 按钮处理问题,在线等
- 一个有关定时器的小问题,一直没想明白,请指教
this->ReleaseDC(pDC)
GetDC()和ReleaseDC必须配对的
把GetDC提到循环外面,循环结束后再ReleaseDC