关闭

MFC重绘函数

293人阅读 评论(0) 收藏 举报
分类:
void CDialogDiagnose::OnPaint()
{
 CPaintDC dc(this); // device context for painting
 // TODO: 在此处添加消息处理程序代码
 CDC MemDC; 
 MemDC.CreateCompatibleDC (&dc);
 CBitmap *pOldBmp;
 pOldBmp = MemDC.SelectObject (&m_bmpToolbar);
 CRect rect;
 GetClientRect(rect);
 dc.StretchBlt(0,0,rect.Width() ,m_nToolBarHeight,&MemDC,0,0,m_nToolBarWidth,m_nToolBarHeight,SRCCOPY);
  if(m_nNotDiagnosed>0 || m_nFailed>0)
 {
  MemDC.SelectObject (&m_bmpUnfinish);
 } 
 else
 {
  MemDC.SelectObject (&m_bmpGoodDiagnose);
 }
 //MemDC.SelectObject (&m_bmpUnfinish);
 //dc.StretchBlt(10,10,m_nGoodDiagnoseBmpWidth ,m_nGoodDiagnoseBmpHeight,&MemDC,0,0,m_nGoodDiagnoseBmpWidth,m_nGoodDiagnoseBmpHeight,SRCCOPY);
  TransparentBlt(dc.m_hDC,10,10,m_nGoodDiagnoseBmpWidth ,m_nGoodDiagnoseBmpHeight,MemDC.m_hDC,0,0,m_nGoodDiagnoseBmpWidth,m_nGoodDiagnoseBmpHeight,RGB(255,255,255));
 MemDC.SelectObject(pOldBmp);
 MemDC.DeleteDC();
 // 不为绘图消息调用 CDialog::OnPaint()
}
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:75457次
    • 积分:1689
    • 等级:
    • 排名:千里之外
    • 原创:70篇
    • 转载:175篇
    • 译文:0篇
    • 评论:1条
    最新评论