[Win32SDK基本]Button Control(3)Group Boxes
2015-07-01 13:48
225 查看
本文由CSDN用户zuishikonghuan所作,转载请注明出处:/article/9672505.html
上两篇中说了push button和check box这两种按钮,上两篇中还算有点东西说,BM_SETIMAGE 和 BM_SETCHECK 嘛,可是 Group Boxes
我实在是不知道说些什么好了,但好歹也是按钮控件的一种,于是就说说。
MSDN:A group box is a rectangle that surrounds a set of controls, such as check boxes or radio buttons, with an application-defined text label in its upper left corner. The sole purpose of a group box is to organize controls related by a common purpose (usually
indicated by the label). The group box has only one style, defined by the constant BS_GROUPBOX. Because a group box cannot be selected, it has no check state, focus state, or push state.
其实还是子窗口,static那节说的很明白了,就不重复了 ,这个控件的风格是 BS_GROUPBOX
还是以我的博客“[Win32SDK基本] 窗口详解(超详细)”(地址:/article/9672496.html)为模板,进一步编写。
先创建全局变量
再创建 Group Boxes:
效果图
值得一提的是,Group Boxes 是窗口的子窗口,但是对于它的子窗口而言,它就是一个父窗口了,换句话说,Group Boxes 本身就是为了成为一个“容器”而设计的。
举例:再创建一个按钮,位置为(10,25),父窗口句柄不再是之前我们用的最早创建的窗口句柄hwnd了,而是用我们刚刚创建的 Group Boxes 的句柄,也就是说用这个 Group Boxes 作父窗口。
代码:
效果图:
上两篇中说了push button和check box这两种按钮,上两篇中还算有点东西说,BM_SETIMAGE 和 BM_SETCHECK 嘛,可是 Group Boxes
我实在是不知道说些什么好了,但好歹也是按钮控件的一种,于是就说说。
MSDN:A group box is a rectangle that surrounds a set of controls, such as check boxes or radio buttons, with an application-defined text label in its upper left corner. The sole purpose of a group box is to organize controls related by a common purpose (usually
indicated by the label). The group box has only one style, defined by the constant BS_GROUPBOX. Because a group box cannot be selected, it has no check state, focus state, or push state.
其实还是子窗口,static那节说的很明白了,就不重复了 ,这个控件的风格是 BS_GROUPBOX
还是以我的博客“[Win32SDK基本] 窗口详解(超详细)”(地址:/article/9672496.html)为模板,进一步编写。
先创建全局变量
HWND button6 = 0;
再创建 Group Boxes:
button6 = CreateWindow(TEXT("Button"), TEXT("Check Boxes"), WS_CHILD | WS_VISIBLE | BS_GROUPBOX, 10, 300, 320, 100, hwnd, (HMENU)8, (HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE), NULL); SendMessage(button6, WM_SETFONT, (WPARAM)GetStockObject(17), 0);
效果图
值得一提的是,Group Boxes 是窗口的子窗口,但是对于它的子窗口而言,它就是一个父窗口了,换句话说,Group Boxes 本身就是为了成为一个“容器”而设计的。
举例:再创建一个按钮,位置为(10,25),父窗口句柄不再是之前我们用的最早创建的窗口句柄hwnd了,而是用我们刚刚创建的 Group Boxes 的句柄,也就是说用这个 Group Boxes 作父窗口。
代码:
button7 = CreateWindow(TEXT("Button"), TEXT("在Group Boxes里的按钮"), WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON, 10, 25, 200, 30, button6, (HMENU)4, (HINSTANCE)GetWindowLong(hwnd, GWL_HINSTANCE), NULL); SendMessage(button7, WM_SETFONT, (WPARAM)GetStockObject(17), 0);
效果图:
相关文章推荐
- 使用NSURLProtocol实现UIWebView的离线缓存
- mysql锁-for update
- IOS 6 自动布局 入门-1
- 安装和使用elasticsearch
- struts2中s:select标签的使用
- 微信开发者
- h5 与 IOS 、安卓 配合的要注意要几点
- iOS开发 调试 网络限速
- android webview中调用了js的时候混淆注意事项
- 用 WEKA 进行数据挖掘
- css垂直居中的方法
- 解决子元素margin让父辈元素位置一起改变的问题
- windows下如何安装pip
- weblogic真实线上业务环境故障解决一例
- DNS服务器
- git submodule(转载)
- Yin ~ Regularized Minimization method
- RTP 头格式
- C#获取上个月第一天和最后一天日期的方法
- Linux Curl命令