Static controls)

Source: Internet
Author: User
Static controls are mainly used to describe and decorate user interfaces.
Static controls can be generated based on their style attributes: static image controls, static text controls, and static self-painted controls.
The static text control is used to display text.
The static image control can be used to display bitmaps, icons, boxes, and graph files. The advantage of displaying images in the image control is that you do not have to worry about redrawing images.
The static control cannot receive user editing input.
Static controls can be usedCreatewindowOrCreatemediawexFunction.
Use the following constants to specify the style of the static control.

Constant Description
Ss_bitmap Display a bitmap (. BMP), the control text (text) specifies a bitmap file (non-file name) contained in the resource, this style ignores the width and height of the control, the widget automatically adjusts the size to adapt to the bitmap.
Ss_icon Display an icon (. ICO). The text of the control specifies an icon file (not a file name) contained in the resource. This style ignores the width and height of the control, the widget automatically adjusts the size to adapt to the icon.
Ss_enhmetafile Display an Enhanced Metafile (. EMF) in the static control ). The text of the control specifies the object name. The widget size remains unchanged, and the Metafile is scaled proportionally in the control client area.
Ss_blackframe Draw a border with the window border color (black by default) of the system color group, and use the same color (transparent) as the bottom form in the box ).
Ss_blackrect Draws a rectangle solid control with the window border color (black by default) of the system color group.
Ss_grayframe Draw a border with the screen background color of the system color group, and use the same color (transparent) as the bottom form in the box ).
Ss_grayrect Draws a rectangle solid control with the screen background color of the system color group.
Ss_whiteframe Draw a border with the background color (white by default) of the system color group, and use the same color (transparent) as the bottom form in the box ).
Ss_whiterect Draws a rectangle solid control with the background color (white by default) of the system color group window.
Ss_etchedframe Draw a border with a concave 3D line, and use the same color (transparent) as the bottom form in the box ).
Ss_etchedhorz Draw the upper and lower sides of the control using a concave 3D line, and use the same color (transparent) as the bottom form in the box ).
Ss_etchedvert Draw the left and right sides of the control using a concave 3D line, and use the same color (transparent) as the bottom form in the box ).
Ss_rightjust In combination with ss_bitmap or ss_icon, when the control size needs to be adjusted automatically, the lower right corner of the control is taken as the benchmark, and only the top and left positions of the control change.
Ss_noprefix It is not allowed to interpret the character "&". Generally, the character "&" is interpreted as adding a line to the next character, and "&" is interpreted as a character "&". you can use ss_noprefix to disable this interpretation.
Ss_policy When the control is clicked or double-clicked by the user, the stn_clicked, stn_dblclk, stn_disable, or stn_enable notification message is sent to the parent window.
Ss_ownerdraw The custom static control. When the control needs to be re-painted, the parent window receives the wm_drawitem message.
Ss_realsizeimage Do not adjust the widget size automatically based on the bitmap Or Icon size. If this constant is set, the excess part of the widget is truncated.
Ss_sunken Draw a sinking control.
Ss_center The text is horizontally centered. Text is formatted before being displayed. If the control width is exceeded, the text is automatically wrapped.
Ss_centerimage The text is vertically centered. This constant also sets that when the bitmap or icon is smaller than the control's customer zone, the color of the top left corner of the image is used to fill the control edge.
Ss_left The text is displayed on the left. Before the text is displayed, the text is formatted. If the control width is exceeded, the text is automatically wrapped.
Ss_leftnowordwrap The text is displayed on the left. When the control width is exceeded, the text is truncated and no line breaks are automatically processed.
Ss_right The text is displayed on the right. Before the text is displayed, the text is formatted. If the control width is exceeded, the text is automatically wrapped.
Ss_simple The text is displayed in a single line in the upper left corner of the control, without line breaks. The parent window process cannot process the wm_ctlcolorstatic message.

When you perform various operations on the button control, its parent window will receive the wm_command notification message, and wparam's 16-bit lower Control ID. Lparam has a control handle (hwnd), and wparam has a 16-bit high message code of the following table.

Stn_clicked Click the control.
Stn_dblclk Double-click the control.
Stn_disable The widget is forbidden.
Stn_enable Controls are allowed.

The application can call sendmessage to send the following message to the control to set and query various parameters of the control.

Umsg Wparam Lparam Description
Pai_setimage Image Type Handle Set the image handle of the static image control. wparam is specified as image_bitmap (Bitmap), image_icon (icon), image_cursor (cursor), or image_enhmetafile (Enhanced Metafile)
Performance_getimage Status 0 Obtain the image handle of the static image control. wparam is specified as image_bitmap (Bitmap), image_icon (icon), image_cursor (cursor), or image_enhmetafile (Enhanced Metafile)
Pai_geticon 0 0 Obtain the icon handle of the static image control.
Pai_seticon Icon handle 0 Set the icon handle of the static image control.

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.