CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
不看会后悔的Windows XP之经验谈 简单快捷DIY实用家庭影院
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VC/MFC >  基础类

画图程序,消除闪烁?

楼主hcl211(散分王)2002-12-12 16:57:35 在 VC/MFC / 基础类 提问

画图程序,消除闪烁? 问题点数:100、回复次数:3Top

1 楼tony1978(突击召唤师)回复于 2002-12-12 16:59:02 得分 15

根据需要处理擦除背景消息  
  重画使用双缓冲  
   
  说说你的具体需要?Top

2 楼hhuangchunlin(林之韵)回复于 2002-12-12 17:03:56 得分 85

BOOL   CGridCtrl::OnEraseBkgnd(CDC*   pDC)    
  {  
  //   TODO:   Add   your   message   handler   code   here   and/or   call   default  
   
  return   TRUE;  
  }  
   
  CPaintDC   dc(this);   //   device   context   for   painting  
   
  CRect   rRect;  
  int   nWidth,nHeight;  
  GetClientRect(&rRect);  
  nWidth=rRect.Width();  
  nHeight=rRect.Height();  
   
   
   
  CDC   MemDC;   //首先定义一个显示设备对象  
          CBitmap   MemBitmap;//定义一个位图对象  
   
          MemDC.CreateCompatibleDC(NULL);  
          MemBitmap.CreateCompatibleBitmap(&dc,nWidth,nHeight);  
          CBitmap   *pOldBit=MemDC.SelectObject(&MemBitmap);  
    //       MemDC.FillSolidRect(0,0,nWidth,nHeight,m_crBackground);  
   
  // MemDC.FillSolidRect(0,0,nWidth,20,RGB(192,192,192));  
  // MemDC.FillSolidRect(0,0,40,nHeight,RGB(192,192,192));  
  DrawBkGround(&MemDC);  
  DrawBkPicture(&MemDC);  
   
  int   nFlag;  
  CRect   rcCur;  
  CRect   rcSel;  
  // GetCurGridCellRect(rcCur);  
  GetCellRect(m_gridPosCur.nRow,m_gridPosCur.nCol,rcCur);  
  GetRectFromRg(m_rgSel,nFlag,rcSel);  
   
  CRgn   rgn1,rgn2;  
  rgn1.CreateRectRgnIndirect(rcSel);  
  rgn2.CreateRectRgnIndirect(rcCur);  
   
  CBrush   brush(RGB(180,190,210));  
  if(rgn1.CombineRgn(&rgn1,&rgn2,RGN_DIFF)   !=   ERROR)  
  MemDC.FillRgn(&rgn1,&brush);  
   
  DrawGrid(&MemDC);  
  DrawGridText(&MemDC);  
  // FillRGSel(&MemDC);  
  //画矩形  
  DrawBlackRect3(&MemDC,rcSel,nFlag);  
   
  CRect   rcClipboard;  
  GetRectFromRg(m_rgClipBoard,nFlag,rcClipboard);  
  // if(m_bCut   ||   m_bCopy)  
  // {  
  // DrawDashRect3(&MemDC,rcClipboard,nFlag);  
   
  // }  
   
  dc.BitBlt(0,0,nWidth,nHeight,&MemDC,0,0,SRCCOPY);  
  MemDC.SelectObject(pOldBit);  
  }Top

3 楼laosanr(天舵)回复于 2003-03-07 09:22:12 得分 0

重载OnEraseBkgnd()(在这里画图)返回trueTop

相关问题

  • 做一个类似Ms 画图的程序,如何消除屏幕闪烁?
  • 无闪烁画图?内存画图
  • 无闪烁画图?在线
  • 画图程序出错
  • vb实现无闪烁画图
  • 在基于对话框的程序中,怎样消除屏幕闪烁?
  • 一个画图程序的问题.......
  • 如何外挂画图程序?
  • 寻画图程序源码,谢谢
  • 谁能给我一个画图程序?

关键词

  • memdc
  • rgn
  • rccur
  • rcsel
  • rrect
  • nheight
  • nwidth
  • membitmap
  • fillsolidrect
  • nflag

得分解答快速导航

  • 帖主:hcl211
  • tony1978
  • hhuangchunlin

相关链接

  • Visual C++类图书
  • Visual C++类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo