关于图片局部放大镜的问题 我用GDI+加载一张图片,后我做了一个放大镜在上面移动,鼠标移动到那个位置就放大它对应的区域。但是放大镜在移动时出现闪烁。有兴趣的朋友帮我解决一下。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 void CTestZoomDlg::OnMouseMove(UINT nFlags, CPoint point) { // TODO: Add your message handler code here and/or call default if(m_IsZoom) { mgraphics->DrawImage(myImage,drawrect,0,0,myImage->GetWidth(),myImage->GetHeight(),UnitPixel); if((point.x>m_DisplayRect.left)&&(point.x<m_DisplayRect.right)&&(point.y>m_DisplayRect.top)&&(point.y<m_DisplayRect.bottom)) { float h; float w; //比例尺 w=float(myImage->GetWidth())/float(m_DisplayRect.Width());//对话框显现图片和实际图片,宽度比例尺 h=float(myImage->GetHeight())/float(m_DisplayRect.Height());//高度比例尺 //放大区域 Rect rc; rc.X=point.x-60; rc.Y=point.y-60-20; rc.Width=120; rc.Height=120; //被放大图片区域 Rect rcd; rcd.X=point.x*w-60; rcd.Y=(point.y-20)*h-60; rcd.Width=100; rcd.Height=100; //图片放大 if(m_IsZoom) { mgraphics->DrawImage(myImage,rc,rcd.X,rcd.Y,100,100,UnitPixel); } } } CDialog::OnMouseMove(nFlags, point);}刷新部分源码 mgraphics这个是什么--------------难道不能另建一个DC实现双缓冲?GDI+没用过 闪烁应该是没用双缓冲你把机制改一下把绘图操作集中在OnPaint中然后OnMouseMove只处理相关数据然后Invalidate GDI+ 双缓存具体这么实现,能给出具体的代码吗? 如何给动态创建的控件关联一个变量? 请问各位朋友,如何为应用程序制作一个超炫动感的启动画面??? CByteArray里有个0x1A,为什么这个字符和他后面的就不能通过串口发出去了?? 简单的绘图问题!!! 怎样设置随机数(rand())的范围?????????? 关于多线程(急) 急,砸分,关于系统资源和用户资源 树型控件中的ImageList? sdk中API哪个是关机的函数 关于消息循环 外派微软的SDE都做些啥?能学到多少东西?如果不干外派了,好找工作不? CDatabase m_db要放在哪里呀
{
// TODO: Add your message handler code here and/or call default if(m_IsZoom)
{ mgraphics->DrawImage(myImage,drawrect,0,0,myImage->GetWidth(),myImage->GetHeight(),UnitPixel); if((point.x>m_DisplayRect.left)&&(point.x<m_DisplayRect.right)&&(point.y>m_DisplayRect.top)&&(point.y<m_DisplayRect.bottom))
{
float h;
float w;
//比例尺
w=float(myImage->GetWidth())/float(m_DisplayRect.Width());//对话框显现图片和实际图片,宽度比例尺
h=float(myImage->GetHeight())/float(m_DisplayRect.Height());//高度比例尺
//放大区域
Rect rc;
rc.X=point.x-60;
rc.Y=point.y-60-20;
rc.Width=120;
rc.Height=120;
//被放大图片区域
Rect rcd;
rcd.X=point.x*w-60;
rcd.Y=(point.y-20)*h-60;
rcd.Width=100;
rcd.Height=100;
//图片放大
if(m_IsZoom)
{
mgraphics->DrawImage(myImage,rc,rcd.X,rcd.Y,100,100,UnitPixel);
}
}
}
CDialog::OnMouseMove(nFlags, point);
}
刷新部分源码
这个是什么
--------------
难道不能另建一个DC实现双缓冲?
GDI+没用过
你把机制改一下
把绘图操作集中在OnPaint中
然后OnMouseMove只处理相关数据
然后Invalidate