zoukankan
html css js c++ java
VC遍历窗体控件的实现
最近在写控制台,在设计界面按钮风格时不想通过每个按钮的ID来获取其句柄,而是通过遍历窗体所有控件,然后判断其控件类型进而来实现。
代码如下:
//
遍历得到页面中的所有Button控件,依次设定其样式和颜色
CWnd
*
pWnd
=
GetWindow(GW_CHILD);
char
cClassName[
255
]
=
...
{
0
}
;
while
(pWnd)
...
{
GetClassName(pWnd
->
GetSafeHwnd(),cClassName,
255
);
//
得到控件的类名,主要有Edit,Button,Static等等
if
(strcmp(cClassName,
"
Button
"
)
==
0
)
//
是Button控件
...
{
CXTButton
*
pBtn
=
(CXTButton
*
) pWnd;
pBtn
->
SetXButtonStyle(BS_XT_XPFLAT);
pBtn
->
SetColorFace(BUTTON_BKCOLOR);
//
按钮背景色
}
pWnd
=
pWnd
->
GetWindow(GW_HWNDNEXT);
}
查看全文
相关阅读:
李洪强经典面试题43
李洪强经典面试题42
李洪强经典面试题41-iOS选择题
HTTP头部解析
iOS
内网安全工具之hscan扫描
跟着百度学PHP[4]OOP面对对象编程-17-多态
绕过注入学习笔记
引用/别名
跟着百度学PHP[4]OOP面对对象编程-16-switch逻辑就语句
原文地址:https://www.cnblogs.com/rainbowzc/p/2422230.html
最新文章
BZOJ4268 : 小强的书架
BZOJ3616 : War
BZOJ4262 : Sum
BZOJ4264 : 小C找朋友
BZOJ2468 : [中山市选2010]三核苷酸
BZOJ3009 : 集合
BZOJ4259 : 残缺的字符串
BZOJ1170 : [Balkan2007]Cipher
BZOJ1712 : [Usaco2007 China]Summing Sums 加密
BZOJ4065 : [Cerc2012]Graphic Madness
热门文章
BZOJ3864 : Hero meet devil
BZOJ4009 : [HNOI2015]接水果
BZOJ3779 : 重组病毒
BZOJ4175 : 小G的电话本
BZOJ3355 : [Usaco2004 Jan]有序奶牛
BZOJ4127 : Abs
BZOJ4129 : Haruna’s Breakfast
李洪强经典面试题45
李洪强经典面试题44
详解CALayer 和 UIView的区别和联系
Copyright © 2011-2022 走看看