当前位置:网站首页>els 方块显示原理
els 方块显示原理
2022-07-27 03:41:00 【joker_0030】
#include"els_h.h"
//背景数组
int g_arrBackGroud[20][10] = {0};
void OnPaint(HDC hDc)
{
//创建兼容性DC。
HDC hMemDC = CreateCompatibleDC(hDc);//内存id为:HMemDc,窗口id hDc。
//创建兼容性位图。
HBITMAP hBitmapBack= CreateCompatibleBitmap(hDc, 500, 600);
//关联起来。
SelectObject(hMemDC, hBitmapBack);
PaintSqare(hMemDC);
//传递:
//返回值:失败返回0,成功返回非零。
//参数1:目标DC,窗口DC
//参数2,3:目标的起始位置,注意是基于我们的窗口。
//参数4,5:区域的大小。
//参数6:源DC,也就是我们的内存DC。
//参数7,8:内存图片的起始位置。
//参数9:传递方式。
//
BitBlt(hDc, 0, 0, 300, 600, hMemDC, 0, 0, SRCCOPY);
//释放DC
DeleteObject(hBitmapBack);
DeleteDC(hMemDC);
}
void Oncreate()
{
}
void PaintSqare(HDC hMemDC)
{
int i = 0,
j = 0;
//画大方块。
Rectangle(hMemDC, 0, 0, 300, 600);//矩形框距离运行窗口的开始位置坐标和截至位置坐标。
//指定一个方块。测试。
g_arrBackGroud[2][4] = 1;
g_arrBackGroud[3][3] = 1;
g_arrBackGroud[3][4] = 1;
g_arrBackGroud[3][5] = 1;
//遍历
for (i =0; i < 20; i++)
{
for (j=0 ; j < 10; j++)
{
if (1 == g_arrBackGroud[i][j])
{
//画方块。
Rectangle(hMemDC, j*30, i*30, j * 30+30, i * 30+30);//矩形框距离运行窗口的开始位置坐标和截至位置坐标。
}
}
}
}
边栏推荐
- spark练习案例(升级版)
- Brightcove任命Dan Freund为首席营收官
- 【LeetCode】Day104-无重叠区间
- JS to realize page Jump and parameter acquisition and loading
- scala 不可变Map 、 可变Map 、Map转换为其他数据类型
- Elastic认证考试:30天必过速通学习指南
- ASP voice notification interface docking demo
- A. Round Down the Price
- Is VR panoramic production a single weapon in the home decoration industry? Why is this?
- Eureka-服务注册中心
猜你喜欢
随机推荐
【软件工程期末复习】知识点+大题详解(E-R图、数据流图、N-S盒图、状态图、活动图、用例图....)
Learning route from junior programmer to architect + complete version of supporting learning resources
细说Hash(哈希)
E-commerce system combined with commodity spike activities, VR panorama continues to bring benefits
Introduction to JVM principle
对NIO的初步理解
Eureka-服务注册中心
ASP语音通知接口对接demo
452 pages, 130000 words, the overall solution of modern smart Township Xueliang project 2022 Edition
好用的shell快捷键
面试题 02.05. 链表求和
面试题 16.05. 阶乘尾数
shel自动设置目录权限
Leetcode daily question: relative sorting of arrays
人很话不多,工程师不耍嘴皮子
centos如何安装mysqldump
Manually build ABP framework from 0 -abp official complete solution and manually build simplified solution practice
js修改对象数组的key值
无有线网络下安装并配置debian
法解析的外部符号 “public: virtual __cdecl nvinfer1::YoloLayerPlugin::~YoloLayerPlugin(void)“ “public: virtua









