Windows window style

Source: Internet
Author: User

Window StyleIt is one of the important foundations of various window development. It can be divided into common styles (WS _Series) and extended style (Ws_ex _Series ). From its characteristics, it is mainly divided into two categories:

1.One class indicates the relationship between a window and other windows, including:Ws_child,Ws_popup,Ws_overlapped,Ws_clipchildren,Ws_clipsiblings,Ws_group,

Ws_ex_topmost,Ws_ex_mdichild. (The relationship here does not meanForeground/background windowAndZ-orderConcept)

2.One class indicates the appearance characteristics of the window, including:Ws_border,Ws_caption,Ws_minimize,Ws_minimizebox,Ws_dlgframe,

Ws_ex_dlgmodalframe,Ws_ex_windowedge.

For example:

A standardDialogWindow,DialogYour own style (DS _Series), the window style is as follows:

Normal style:Ws_caption | ws_popup | ws_visible | ws_clipsiblings | ws_sysmenu

Extended style:Ws_ex_left | ws_ex_ltrreading | ws_ex_rightscrollbar | ws_ex_dlgmodalframe | ws_ex_1_wedge | ws_ex_controlparent | ws_ex_appwindow

A standardFrameWindow. Its style is as follows:

Normal style:Ws_caption | ws_overlapped | ws_visible | ws_clipsiblings | ws_clipchildren | ws_sysmenu | ws_maximize | ws_thickframe | ws_minimizebox | ws_maximizebox

Extended Style: Ws_ex_left | ws_ex_ltrreading | ws_ex_rightscrollbar | ws_ex_1_wedge

Most of the window styles are easy to understand. The following describes the main differences in the first style:

    • Ws_popupAndWs_overlappedWindows areTop-levelWindow, that is, ifSetwindowposTo change its location, you need to useScreenCoordinates insteadClientCoordinates. The difference is that,Ws_popupThe window has a parent window. UseGetparentAndWs_overlappedNo window,GetparentMethod:Null. That is to say, for an interface applicationProgramThere must be at least oneWs_overlappedWindow (as the main window of the application ).

In addition,Ws_overlappedWindow always hasTitle BarAndBorder, Even if you show DeletionWs_captionAndWs_borderStyle, whileWs_popupBut does not have this feature.

    • Ws_clipchildren: Exclude the areas occupied by subwindows in the window when drawing. This style can be used when you create a parent window. If you useInvalidateMethod, which is not included in the update area. Therefore, these subwindows may not be refreshed.
    • Ws_clipsiblings: When plotting, exclude the overlapping areas of the Child Window and other child windows of the same level (with the same parent window. If you useInvalidateMethod, which is not included in the update area. In this case, the painting will not be painted in other windows.
    • Ws_ex_appwindow: Force OneTop-levelWhen the window is visibleTaskbar. But this does not mean that a window appears inTaskbarIn fact, if it is the first window of the main thread (M_pmainwnd).Taskbar.
    • Ws_ex_layered: CreateLayeredWindow: A window with complex visual features, such as transparent window. This style cannot be used in subwindows. Mainly includeSetlayeredwindowattributesAndUpdatelayeredwindowThe latter is more flexible. The former is usually used to implement simple tasks such as transparent windows.

 

As mentioned aboveTop-levelWindow, so it is necessary to explain the differences between the following methods:

GetparentMethod: if it is a subwindow (Ws_childStyle), you can always get a valid temporary window object (Immediate window); If yesTop-levelWindow: if the window is not owned (Unowned), Then returnNullOtherwise, the owner window object is returned. Therefore,GetparentThe parent window is not always returned.

GetownerMethod: Obtain the owner window. The default window is the parent window. The child window in the Parent and Child Window can only appear in the customer area of the parent window, while the window with the owner window can appear in any location on the desktop. HereOwnerWindow, different fromAPIMethodGetwindowObtainedOwnerWindow, which isMFCSpecific concepts.

GetancestorMethod: Obtain the ancestor window. There are three options,Ga_parent, ga_root, ga_rootowner

 

MFCInImmediateWindow: InMsdnAboutMFCIs often seen in the descriptionImmediateAndPermanent window. Where,ImmediateWindow isMFCWindow objects temporarily generated in,MFCThese objects are cleared regularly, so they cannot be saved as class member variables.

original address: http://citycowboy.blog.sohu.com/82857453.html

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.