2 cn8610000 cn8610000 于 2017.05.19 15:19 提问

WIN32 帮忙逐句解释程序,谢谢 3C

#include "stdafx.h"
#include "resource.h"

HINSTANCE g_hInst = NULL;

//变量的定义
HBITMAP g_hBmpMine = NULL; //雷的图片
HBITMAP g_hBmpNumber = NULL; //数字的图片
HBITMAP g_hBmpFace = NULL; //脸的图片

DWORD g_nMineBmp[10][10] = { 0 }; //

DWORD g_nMineFlag[10][10] = { 1 };

//create函数的调用
void OnCreate( HWND hWnd )
{
g_hBmpMine = LoadBitmap( g_hInst, //加载资源,返回句柄 HBITMAP
MAKEINTRESOURCE(IDB_MINE) );
g_hBmpNumber = LoadBitmap( g_hInst,
MAKEINTRESOURCE(IDB_NUMBER) );
g_hBmpFace = LoadBitmap( g_hInst,
MAKEINTRESOURCE(IDB_FACE) );
}

void DrawMine( HDC hDC )
{
HDC hBmpDC = CreateCompatibleDC( hDC );
HBITMAP hOldBmp = (HBITMAP)
SelectObject( hBmpDC, g_hBmpMine );

for( DWORD nX=0; nX<10; nX++ )
{
    for( DWORD nY=0; nY<10; nY++ )
    {
        int nSrxX = 0;//g_nMineBmp[nX][nY];
        int nSrxY = g_nMineBmp[nX][nY] * 16;

        BitBlt( hDC, nX * 16, nY * 16, 
            16, 16, hBmpDC, nSrxX,nSrxY, SRCCOPY ); //nSrxX/Y资源的图
    }
}

SelectObject( hBmpDC, hOldBmp );
DeleteDC( hBmpDC ); //DeleteDC

}

void OnPaint( HWND hWnd ) //BeginPaint EndPaint
{
PAINTSTRUCT ps = { 0 };
HDC hDC = BeginPaint( hWnd, &ps );
//绘制边框
//绘制信息区
//绘制雷区
DrawMine( hDC );

EndPaint( hWnd, &ps ); //&ps返回ps指针

}

3个回答

devmiao
devmiao   Ds   Rxr 2017.05.20 01:08

雇个私人家教,手把手教你吧。

devmiao
devmiao   Ds   Rxr 2017.07.09 20:47

这问题没人回答你吧。一看lz就是不想花钱想讨便宜的奇葩。

what951006
what951006   2017.05.22 11:53

题主是伸手党啊。。 。

Csdn user default icon
上传中...
上传图片
插入图片