xtd 0.2.0
Loading...
Searching...
No Matches

◆ control_styles

enum class xtd::forms::control_styles
strong

Specifies the style and behavior of a control.

Header
#include <xtd/forms/control_styles>
Namespace
xtd::forms
Library
xtd.forms
Remarks
This enumeration has a flags attribute that allows a bitwise combination of its member values.
Controls use this enumeration in various properties and methods to specify functionality. A control can enable a style by calling the set_style method and passing in the appropriate control_styles bit (or bits) and the bool value to set the bit(s) to. For example, the following line code would enable double-buffering.
@ user_paint
If true, the control paints itself rather than the operating system doing so. If false,...
@ double_buffer
If true, drawing is performed in a buffer, and after it completes, the result is output to the screen...
@ all_painting_in_wm_paint
If true, the control ignores the window message WM_ERASEBKGND to reduce flicker. This style should on...
If the all_painting_in_wm_paint bit is set to true, the window message WM_ERASEBKGND is ignored, and both on_paint_background and on_paint methods are called directly from the window message WM_PAINT. This generally reduces flicker unless other controls send the window message WM_ERASEBKGND to the control. You might send the window message WM_ERASEBKGRND to achieve a pseudo-transparent effect similar to supports_transparent_back_color; for example, a tool_bar with flat appearance does this.
To fully enable double-buffering, you can set the optimized_double_buffer and all_painting_in_wm_paint bits to true. However the preferred method for enabling double buffering, which yields the same result, is to set the double_buffered property for the control to true.
If the supports_transparent_back_color bit is set to true, and the back_color is set to a color whose alpha component is less than 255, on_paint_background will simulate transparency by asking its parent control to paint the background. This is not true transparency.
Note
If there is another control between the control and its parent, the current control will not show the control in the middle.
Remarks
When the user_mouse bit is set to true, the following methods are still called: control::on_mouse_down, control::on_mouse_up, control::on_mouse_enter, control::on_mouse_move, control::on_mouse_hover, control::on_mouse_leave, and control::on_mouse_wheel.
When the control is clicked, if the standard_click bit is set to true the control::on_click method is called and it raises the control::click event. When the control is double-clicked, and both the standard_click and standard_double_click bits are set to true, the click is passed on to the xtd::forms::control::double_click event. Then the Control::on_double_click method is called and it raises the control::double_click event. However, the control can call on_click or on_double_click directly regardless of the standard_click and standard_double_click bit values. For more information on control click and double click behaviors, see the control::click and control::double_click topics.
When the use_text_for_accessibility bit is set and there is a value in the control's text property, the value of that control's text property determines the control's default active accessibility name and shortcut key. Otherwise, the text of the preceding label control will be used instead. This style is set by default. Certain built-in control types, such as text_box and combo_box, reset this style so that the text property of those controls will not be used by active accessibility.
Enumerator
none 

No control style..

container_control 

If true, the control is a container-like control.

user_paint 

If true, the control paints itself rather than the operating system doing so. If false, the xtd::forms::control::paint event is not raised. This style only applies to classes derived from control.

opaque 

If true, the control is drawn opaque and the background is not painted.

resize_redraw 

If true, the control is redrawn when it is resized.

fixed_width 

If true, the control has a fixed width when auto-scaled. For example, if a layout operation attempts to rescale the control to accommodate a new font, the control's width remains unchanged.

fixed_height 

If true, the control has a fixed height when auto-scaled. For example, if a layout operation attempts to rescale the control to accommodate a new font, the control's height remains unchanged.

standard_click 

If true, the control implements the standard click behavior.

selectable 

If true, the control can receive focus.

user_mouse 

If true, the control does its own mouse processing, and mouse events are not handled by the operating system.

supports_transparent_back_color 

If true, the control accepts a BackColor with an alpha component of less than 255 to simulate transparency. Transparency will be simulated only if the UserPaint bit is set to true and the parent control is derived from Control.

standard_double_click 

If true, the control implements the standard double_click behavior. This style is ignored if the standard_click bit is not set to true.

all_painting_in_wm_paint 

If true, the control ignores the window message WM_ERASEBKGND to reduce flicker. This style should only be applied if the user_paint bit is set to true.

cache_text 

If true, the control keeps a copy of the text rather than getting it from the handle each time it is needed. This style defaults to false. This behavior improves performance, but makes it difficult to keep the text synchronized.

enable_notify_message 

If true, the on_notify_message(message&) method is called for every message sent to the control's wnd_proc(message&). This style defaults to false. enable_notify_message does not work in partial trust.

double_buffer 

If true, drawing is performed in a buffer, and after it completes, the result is output to the screen. Double-buffering prevents flicker caused by the redrawing of the control. If you set double_buffer to true, you should also set user_paint and all_painting_in_wm_paint to true.

optimized_double_buffer 

If true, the control is first drawn to a buffer rather than directly to the screen, which can reduce flicker. If you set this property to true, you should also set the all_painting_in_wm_paint to true.

use_text_for_accessibility 

Specifies that the value of the control's text property, if set, determines the control's default active accessibility name and shortcut key.