当前位置:网站首页>MFC图片控件
MFC图片控件
2022-07-26 10:42:00 【Forest_1010】
图片控件可以显示图片,其本质是CStatic类,只需要创建的时候dwStyle制定样式SS_BITMAP即可。
第一步:在对话框类中定义:
CStatic m_picture;
第二步:在对话框类的OnInitDialog函数中:
m_picture.Create(L"XX",WS_CHILD|WS_VISIBLE|WS_BORDER|SS_BITMAP,
CRect(100,100,300,300),this,10000);//创建该图片控件
//参数1:随便写,不会显示的
//参数2:dwStyle制定样式SS_BITMAP
//参数3:图片显示区域 左上角坐标(100,100) 右下角(300,300)
//参数4:父窗口,this是指该对话框窗口
第三步:添加一张位图资源
第四步:为图片控件加载位图
HBITMAP hBmp=LoadBitmap(AfxGetInstanceHandle(),//实例句柄
MAKEINTRESOURCE(IDB_BITMAP1_ONE));//通过资源加载位图
m_picture.SetBitmap(hBmp);
如果图片太大的话,则不能完全显示,可以使用DC绘图实现图片的缩放。
边栏推荐
- [leetcode daily question 2021/4/23]368. Maximum divisible subset
- json_ object_ put: Assertion `jso->_ ref_ count > 0‘ failed. Aborted (core dumped)
- winpcap 抓包函数pcap_loop(),停止问题
- [leetcode每日一题2021/8/30]528. 按权重随机选择【中等】
- 工厂模式详解
- MySQL速学-2021-09-01
- Flutter集成极光推送
- oracle 启动不了 tnslistener服务启动不了
- 2021-08-13和鹏哥学C语言-数组
- 剑指Offer(四十四):翻转单词顺序序列
猜你喜欢
![[leetcode每日一题2021/8/30]528. 按权重随机选择【中等】](/img/13/c6cb176d7065035f60d55ad20ed1bf.png)
[leetcode每日一题2021/8/30]528. 按权重随机选择【中等】

The problem of large fluctuation of hx711 data

RT-Thread 学习笔记(五)---编辑、下载、调试程序

20210807#1 C语言程序结构

Centos8 (liunx) deploying WTM (asp.net 5) using PgSQL

Mlx90640 infrared thermal imager temperature sensor module development notes (VI) pseudo color coding of infrared images

第7期:内卷和躺平,你怎么选

Dry goods likeshop takeout order system is open source, 100% open source, no encryption
![[leetcode daily question 2021/2/13]448. Find all the missing numbers in the array](/img/9b/624416fa6a408bf64ca5438273176b.png)
[leetcode daily question 2021/2/13]448. Find all the missing numbers in the array

Application of.Net open source framework in industrial production
随机推荐
putty的使用教程
IAR sprintf 浮点 在UCOS 总格式化成0.0的问题
Error[pe147]: declaration is incompatible with 'error problem
Database functions
在神州IV开发板上为STemWin 5.22加入触屏驱动
英语基础句型结构------起源
RT-Thread 学习笔记(三)---用SCons 构建编译环境
SuperMap IClient for Leaflet 加载高斯克吕格投影三度分带CGCS2000大地坐标系WMTS服务
Flutter 防止科学计数并去除尾数无效0
Happens-Before原则深入解读
[leetcode daily question 2021/2/18] [detailed explanation] minimum number of turns of 995. K continuous bits
Redis implementation of distributed lock solution
13 managing resources by objects
鹏哥C语言第六节课
.net operation redis sorted set ordered set
MySQL速学笔记-2021-08-31
鹏哥C语言第七节课总结
扫雷pro版2021-08-19
Sql Server之查询总结
[leetcode每日一题2021/4/29]403. 青蛙过河