对话框无法重新绘制

编程入门 行业动态 更新时间:2024-10-26 14:38:42
本文介绍了对话框无法重新绘制的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

你好, 请原谅下面的代码.我现在只是在骇客. 我有一个问题,基本上下面的代码显示3张图像. 第一个图像显示背景,其余两个较小的图像是简单徽标.它呈现的很好,但是当我拖动对话框时.无法重新绘制背景吗? 有人会这么友善并启发我解决这个问题以及如何解决它.我的记忆确实不好. 谢谢, 加里克

Hello, Please excuse the code below. I''m just hacking at the moment. I have a question, essentially the below code displays 3 images. The 1st image displays the background, and the remaining 2 smaller images are simple logos. It renders fine, however when I drag the dialog box. It fails to re-paint the background? Could somebody be so kind and enlighten me on this problem and how to resolve it. My memory is indeed bad. Thanks, Garyc

void CtesterDlg::OnPaint() { CPaintDC dc( this ); // Device context for painting CBitmap bmp, *poldbmp; CDC memdc; // Load the bitmap resource bmp.LoadBitmap(IDB_BITMAP1); // Create a compatible memory DC memdc.CreateCompatibleDC( &dc ); // Select the bitmap into the DC poldbmp = memdc.SelectObject( &bmp ); // Copy (BitBlt) bitmap from memory DC to screen DC dc.BitBlt(0, 0,2000,4000, &memdc, 0, 0, SRCCOPY ); // Copy (BitBlt) bitmap from memory DC to screen DC memdc.SelectObject( poldbmp ); // Load the bitmap resource bmp.LoadBitmap(IDB_BITMAP2); // Create a compatible memory DC memdc.CreateCompatibleDC( &dc ); // Select the bitmap into the DC poldbmp = memdc.SelectObject( &bmp ); // Copy (BitBlt) bitmap from memory DC to screen DC dc.BitBlt(20,320,400,400, &memdc, 0, 0, SRCCOPY ); memdc.SelectObject( poldbmp ); // Load the bitmap resource bmp.LoadBitmap(IDB_BITMAP3); // Create a compatible memory DC memdc.CreateCompatibleDC( &dc ); // Select the bitmap into the DC poldbmp = memdc.SelectObject( &bmp ); // Copy (BitBlt) bitmap from memory DC to screen DC dc.BitBlt(550,320,450,6000, &memdc, 0, 0, SRCCOPY ); }

推荐答案

:) 启示1:每次使用后尝试memdc.DeleteDC() 启蒙0:我们应该尝试通过调试(行,堆栈,var,regs ...)来分析每个断言/异常. :) Enlightenment 1: Try memdc.DeleteDC() after its each usage Enlightenment 0: We should try to analyze every assertion/exception by debugging (line, stack, vars, regs...)

尝试刷新对话框. CDialog :: Invalidate(1); CDialog :: UpdateWindow(); try refreshing the dialog box. CDialog::Invalidate(1); CDialog::UpdateWindow();

更多推荐

对话框无法重新绘制

本文发布于:2023-11-17 06:28:36,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1609156.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:对话框

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!