ModifyStyle函数

MFC中,CDialog窗口的可调整大小属性可通过对话框资源的""Border""项设置。ModifyStyle()函数用于修改窗口风格,如添加或删除WS_BORDER, WS_DLGFRAME, WS_SIZEBOX等样式。示例代码展示了如何使用ModifyStyle禁用或启用控件的WS_DISABLED属性,并屏蔽窗口的WS_THICKFRAME和WS_MINIMIZEBOX风格。" 22662593,2725639,使用Nero刻录系统光盘步骤详解,"['Nero软件', '光盘刻录']
摘要由CSDN通过智能技术生成

MFC的对话框CDialog是怎么控制窗口可调整大小的属性的呢?
打开资源文件,对话框资源的属性列表中,有一个“Border”项,改变该项的值就可以改变窗口边框风格。实际上windows窗口是否可调整大小,就是根据边框的风格来确定的。窗口风格中与边框有关的值如下:

WS_BORDER - Thin-line border,不能调整大小;
WS_DLGFRAME - dialog box typical border,不能调整大小;
WS_SIZEBOX - sizing border,可以调整大小;
WS_THICKFRAME - 同WS_SIZEBOX。
ModifyStyle()函数修改窗体控件属性
1.作用:Call this member function to modify a window’s style.
2.函数原型:
BOOL ModifyStyle

(

DWORD dwRemove,

DWORD dwAdd,

UINT nFlags

);

3.参数含义:
dwRemove指定要删除的扩展属性,

dwAdd指定修改时要增加的扩展属性,

nFlag标志一般设置为0。

4.用法:
1、修改控件的原有属性用 ModifyStyle(1,WS_DISABLED);(实际测试时只要是>=0的整形数就行)

2、改回来的话要用ModifyStyle(WS_DISABLED,1);(实际测试时只要是>=0的整形数就行)

如果把参数想像成布尔值的话就使用1这个整形数,要除去控件的属性就让第一个参数dwRemove为真,修改回来就让第二个参数dwAdd为真.

5.参考代码:

MFC开发过程序所需的ModifyStyle(needDelStyle,needAddStyle,SWP_FRAMECHANGED); Sytel: WS_BORDER Creates a window that has a border. WS_CAPTION Creates a window that has a title bar (implies the WS_BORDER style). Cannot be used with the WS_DLGFRAME style. WS_CHILD Creates a child window. Cannot be used with the WS_POPUP style. WS_CHILDWINDOW Same as the WS_CHILD style. WS_CLIPCHILDREN Excludes the area occupied by child windows when you draw within the parent window. Used when you create the parent window. WS_CLIPSIBLINGS Clips child windows relative to each other; that is, when a particular child window receives a paint message, the WS_CLIPSIBLINGS style clips all other overlapped child windows out of the region of the child window to be updated. (If WS_CLIPSIBLINGS is not given and child windows overlap, when you draw within the client area of a child window, it is possible to draw within the client area of a neighboring child window.) For use with the WS_CHILD style only. WS_DISABLED Creates a window that is initially disabled. WS_DLGFRAME Creates a window with a double border but no title. WS_GROUP Specifies the first control of a group of controls in which the user can move from one control to the next with the arrow keys. All controls defined with the WS_GROUP style FALSE after the first control belong to the same group. The next control with the WS_GROUP style starts the next group (that is, one group ends where the next begins). WS_HSCROLL Creates a window that has a horizontal scroll bar. WS_ICONIC Creates a window that is initially minimized. Same as the WS_MINIMIZE style. WS_MAXIMIZE Creates a window of maximum size. WS_MAXIMIZEBOX Creates a window that has a Maximize button. WS_MINIMIZE Creates a window that is initially minimized. For use with the WS_OVERLAPPED style only. WS_MINIMIZEBOX Creates a window that has a Minimize button. WS_OVERLAPPED Creates an overlapped window. An overlapped window usually has a caption a
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值