DIALOG styles

本文深入解析了对话框样式,包括3D外观、坐标系统、居中显示、上下文帮助等功能,详细介绍了各种对话框风格的用途及效果。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

DIALOG styles

DS_3DLOOK
Give the dialog box a non-bold font,
and draw three-dimensional borders around controls in the dialog box.
The %DS_3DLOOK style is not required by applications marked with #OPTION VERSION4 or #OPTION VERSION5;
as Windows automatically applies the 3D appearance. DDT dialogs are always created with this style.
(default)

DS_ABSALIGN
Indicate that the coordinates of the dialog box are screen coordinates;
otherwise, Windows assumes they are client coordinates.

DS_CENTER
Center the dialog box in the working area (the area not obscured by the task bar and system tray).
This is the default if x& and y& are not specified.

DS_CENTERMOUSE
Center the mouse cursor in the dialog box when the dialog is initially created.

DS_CONTEXTHELP
Include a question mark in the title bar of the dialog box.
When the user clicks the question mark, the cursor changes to a question mark with a pointer.
If the user then clicks a control in the dialog box, the dialog callback receives a %WM_HELP message.
This style cannot be used with the %WS_MAXIMIZEBOX and %WS_MINIMIZEBOX styles. Also see %WS_EX_CONTEXTHELP.

DS_CONTROL
Create a dialog that works as a child control of another dialog,
smoothing the keyboard focus interface across the two dialogs when the TAB key or control accelerators are used.
Typically used for dialogs that form the "pages" for tab controls and property-sheets.

DS_MODALFRAME
Create a dialog box with a modal dialog-box frame
that can be combined with a title bar and System menu by specifying the %WS_CAPTION and %WS_SYSMENU styles.
(default)

DS_NOFAILCREATE
The dialog is created regardless of any errors that may occur during the creation phase.
DDT dialogs are always created with this style.
(default)

DS_SETFONT
The font to be used by a DDT dialog and its controls can be predetermined with the DIALOG FONT statement.
If the DIALOG FONT statement is not used, the default font (MS Sans Serif, 8 point) is used.
The size of the dialog font proportionately affects the conversion of dialog units values into pixels,
so an increase in default font size will automatically create a larger dialog,
even through the dialog dimensions have remained constant. As child controls are added to a %DS_SETFONT dialog,
they will be sent a %WM_SETFONT message to ensure they also make use of the specified dialog font.
DDT dialogs are always created with this style.
(default)

DS_SETFOREGROUND
Bring the dialog box to the foreground.
Internally, Windows calls the SetForegroundWindow API function for the dialog box.

DS_SYSMODAL
Create a system-modal dialog box.
This style causes the dialog box to have the %WS_EX_TOPMOST style,
but otherwise has no effect on the dialog box or the behavior of other applications
and windows when the dialog box is displayed.

WS_BORDER
Create a dialog that has a thin-line (non-resizing) border.

WS_CAPTION
Create a dialog that has a title bar.
Includes the %WS_BORDER and %WS_DLGFRAME styles.
When this style is used, the width& and height& parameters specify the size of the client area of the dialog,
otherwise they specify the outer dimensions of the dialog.
(default)

WS_CHILD
Create a child dialog.Cannot be used with the %WS_POPUP style.
Typically used with %DS_CONTROL for tab control and property sheet "pages".

WS_CLIPCHILDREN
Exclude the area occupied by child controls when drawing occurs on the dialog background
FRAME and LINE controls on a dialog with this style usually use the extended style %WS_EX_TRANSPARENT
so the background of those controls is drawn by the dialog before the controls are drawn
%WS_CLIPCHILDREN is commonly used to reduce redraw flicker when a %WS_THICKFRAME style dialog is being resized


WS_CLIPSIBLINGS
Child controls are clipped (not overdrawn) by one another when the dialog window is repainted
(default)

WS_DISABLED
%WS_DISABLED Create a dialog that is initially disabled
A disabled dialog cannot receive input from the user


WS_DLGFRAME
Create a window that has a border of the style typically used with dialog boxes
(default)

WS_HSCROLL
Dialog contains a horizontal scroll bar


WS_MAXIMIZEBOX
Create a dialog that has a Maximize button
Use with the %WS_SYSMENU style


WS_MINIMIZEBOX
Create a dialog that has a Minimize button
Use with the %WS_SYSMENU style


WS_OVERLAPPED
Create an overlapped window
An overlapped window has a title bar (caption) and a border
Synonym of the obsolete style %WS_TILED


WS_POPUP
Create a popup dialog
When used by itself, a flat dialog is created with no caption or borders
Combine with %DS_MODALFRAME to create a 3D border
A popup dialog can overlap another window or dialog
(default)

WS_SYSMENU
Create a dialog that has a System-menu box in its title bar
Must be used with the %WS_CAPTION style


WS_THICKFRAME
Create a dialog that has a sizing border
That is, the dialog will be resizable


WS_VSCROLL
Dialog contains a vertical scroll bar
Also see %WS_EX_LEFTSCROLLBAR




Extended Styles
WS_EX_ACCEPTFILES
The dialog accepts Drag+Drop files
The dialog Callback Function receives a %WM_DROPFILES message when files have been dropped onto the dialog


WS_EX_APPWINDOW
Force a top-level dialog onto the application taskbar when the window is minimized


WS_EX_CLIENTEDGE
Dialog has a border with a sunken edge


WS_EX_CONTEXTHELP
Include a question mark in the title bar of the dialog
When the user clicks the question mark, the cursor changes to a question mark with a pointer
If the user then clicks a child window, the child receives a %WM_HELP message
Also see %DS_CONTEXTHELP


WS_EX_CONTROLPARENT
The user may navigate among the child dialogs of the window by using the TAB key
See %DS_CONTROL


WS_EX_LEFT
Dialog has generic "left-aligned" properties
(default)

WS_EX_LEFTSCROLLBAR
If present, the vertical scroll bar is positioned to the left of the client area
Also see %WS_VSCROLL


WS_EX_LTRREADING
Display the caption text using Left to Right reading-order properties
(default)

WS_EX_NOPARENTNOTIFY
Suppress %WM_PARENTNOTIFY messages when dialog is created or destroyed


WS_EX_RIGHT
Dialog has generic "right-aligned" properties that depend on the window class
This style has an effect only if the shell language is Hebrew, Arabic,
or another language that supports reading order alignment
Otherwise, the style is ignored


WS_EX_RIGHTSCROLLBAR
If present, the vertical scroll bar is positioned to the right of the client area
See %WS_VSCROLL
(default)

WS_EX_RTLREADING
If the shell language is Hebrew, Arabic, or another language that supports reading order alignment,
the caption text is displayed using Right to Left reading-order properties
For other languages, the style is ignored


WS_EX_STATICEDGE
Dialog has a 3D border
Primarily used for dialogs that do not require user-input


WS_EX_TOOLWINDOW
Create a tool window (a window intended to be used as a floating toolbar)
A tool window has a shorter than normal caption area and the dialog caption is drawn using a smaller font
A tool window does not appear in the task bar, or in the window that appears when the user presses ALT+TAB
The hybrid versions of Windows (95/98/ME) may require this extended style to be added after creation,
using the SetWindowLong API function


WS_EX_TOPMOST
Place dialog above all non-topmost windows and keep it above them, even while the dialog is deactivated


WS_EX_TRANSPARENT
Controls/windows beneath the dialog are drawn before the dialog is drawn
The dialog is deemed transparent because elements behind the dialog have already been painted
- the dialog itself is not drawn differently
True transparency is achieved by using Regions
- see MSDN and/or the Platform SDK documentation for more information


WS_EX_WINDOWEDGE
Dialog has a border with a raised edge

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值