runxinzhi.com
首页
百度搜索
VC更改View背景色的几种方式
1。添加消息映射OnEraseBkgnd,
BOOL CSampleView::OnEraseBkgnd(CDC
*
pDC)
{
//
设置所要求背景色的刷子
CBrush backBrush(RGB(
255
,
128
,
128
));
//
保存旧刷子
CBrush
*
pOldBrush
=
pDC
->
SelectObject(
&
backBrush);
CRect rect;
pDC
->
GetClipBox(
&
rect);
//
擦除所需的区域
pDC
->
PatBlt(rect.left, rect.top, rect.Width(), rect.Height(), PATCOPY);
pDC
->
SelectObject(pOldBrush);
return
TRUE;
}
2。添加消息映射OnDraw
void
CScrollSampleView::OnDraw(CDC
*
pDC)
{
CScrollSampleDoc
*
pDoc
=
GetDocument();
ASSERT_VALID(pDoc);
if
(
!
pDoc)
return
;
//
TODO: 在此处为本机数据添加绘制代码
CRect rc;
GetClientRect(
&
rc);
CBrush br(RGB(
0
,
0
,
0
));
pDC
->
FillRect(
&
rc,
&
br);
ReleaseDC(pDc);
}
OnEraseBkgnd先于OnDraw被触发
相关阅读:
go语言圣经第8章Goroutines 和 Channels
VSCODE远程开发 golang环境配置
golang排序简述
go语言圣经第七章笔记-接口
Java并发编程小记
[Effective Modern C++] Item 7. Distinguish between () and {} when creating objects
[Effective Modern C++] Item 6. Use the explicitly typed initializer idiom when auto deduces undesired types
[Effective Modern C++] Item 5. Prefer auto to explicit type declarations
[Effective Modern C++] Item 4. Know how to view deduced types
[Effective Modern C++] Item 3. Understand decltype
原文地址:https://www.cnblogs.com/youxin/p/2858130.html
最新文章
路人
2017,杂聊几句
金木研
时过境迁,物是人非
你的名字
现在的你不能再混再疯再懒惰了
不要浪费时间追忆失去的东西
世界笑我太虚伪,我笑世界太现实
Java之试题
CSS之旋转立方体
热门文章
再出发
Android之提示Toast
Android之获取输入用户名与密码发送短信
天冷了别感冒了
用Golang写一个简单的eventBus(Pub/Sub)
多类加载器的单例模式
非阻塞IO和异步IO的区别
设计原则与设计模式
用户态与内核态
读书笔记-go语言实战-go 并发模式
Copyright © 2020-2023
润新知