readme.wzd

来自「本书通过85个实例全面讲述了应用MFC进行Visual C++编程的思想。每个实」· WZD 代码 · 共 37 行

WZD
37
字号
/////////////////////////////////////////////////////////////////////
// Modify any class.
/////////////////////////////////////////////////////////////////////

// 1) to load bitmap from resource file
	CBitmap bitmap;
	bitmap.LoadBitmap(IDB_WZD);

// 2) to draw that bitmap to a device context
	CDC dcComp;
	dcComp.CreateCompatibleDC(pDC);
	dcComp.SelectObject(&bitmap);
	BITMAP bmInfo;
	bitmap.GetObject(sizeof(bmInfo),&bmInfo);
	pDC->BitBlt(0,0,bmInfo.bmWidth,bmInfo.bmHeight, &dcComp, 0,0,SRCCOPY);

// 3) to load bitmap directly from a file
	CBitmap bitmap;
	HBITMAP hbitmap = (HBITMAP)LoadImage(
		NULL,				// handle of the instance that contains the image
		"Wzd2.bmp",			// name or identifier of image
		IMAGE_BITMAP,		// type of image-- can also be IMAGE_CURSOR or IMAGE_ICON 
		0,0,				// desired width and height
		LR_LOADFROMFILE);	// load flags-- with LR_LOADTRANSPARENT makes transparent to bkgrnd
 
	bitmap.Attach(hbitmap);

// 4) draw as before



/////////////////////////////////////////////////////////////////////
// From: Visual C++ MFC Programming by Example by John E. Swanke
// Copyright (C) 1998 jeswanke. All rights reserved.
/////////////////////////////////////////////////////////////////////

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?