在显示两个图像时,第二图像与第一图像重叠 [英] on displaying two images second image overlapps first image

查看:131
本文介绍了在显示两个图像时,第二图像与第一图像重叠的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个程序,用于在字符选择上显示多个图像:

我的代码在WM_CHAR上:



I''m writing a program to display multiple images on character select:
my code is on WM_CHAR:

case WM_CHAR:
		{
		
		switch((char)wParam)
		{
				
		case 'A': case 'a':
			
		hbmp =  LoadBitmap(hInst, MAKEINTRESOURCE(IDB_BITMAP2));

		break;
		case 'B': case 'b':	
	
			hbmp =  LoadBitmap(hInst, MAKEINTRESOURCE(IDB_BITMAP3));
			
			break;
			case 'C': case 'c':
			hbmp =  LoadBitmap(hInst, MAKEINTRESOURCE(IDB_BITMAP4));
			
			break;
		 default:
            break;
		
		}
		}
		break;





和关于油漆事件:





and on paint event:

case WM_PAINT:

		{
 hDC = GetDC(picBoxDisp);
  
 	    /* Create a memory device compatible with the above DC variable*/
	    MemDCExercising = CreateCompatibleDC(hDC);
             /* Select the new bitmap*/
             SelectObject(MemDCExercising, hbmp);
	    /* Copy the bits from the memory DC into the current dc*/
	    BitBlt(hDC, 0, 0, 200, 200, MemDCExercising, 0, 0, SRCCOPY);
DeleteObject(hbmp);			
    DeleteDC(MemDCExercising);
	
	SendMessage(picBoxDisp,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)hbmp);



图像正在显示但是第二张图像是第一张和第三张是超过秒。

如何删除上一张图片?


Images are being shown but second image is over first and third is over second.
How to erase the previous image?

推荐答案

请不要在多个论坛中发布相同的问题。我已经在 http:// www。 codeproject.com/Messages/4500317/On-displaying-two-images-second-image-overlapps-fi.aspx [ ^ ]。
Please do not post the same question in multiple forums. I already responded to this at http://www.codeproject.com/Messages/4500317/On-displaying-two-images-second-image-overlapps-fi.aspx[^].


It''完成使用InvalidateRect()。
It''s completed on using InvalidateRect().


这篇关于在显示两个图像时,第二图像与第一图像重叠的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆