[]
The Style class contains display attributes that determine the appearance of content on the screen/printer. It includes most elements found in Css styles.
The Style class also contains methods for rendering and measuring content (strings and images) based on the style settings (fonts, margins, etc).
The Style objects are not hierarchical in the sense that they don't have parent styles and don't inherit attributes from the parent style. To create a new style based on an existing one, you would clone the original style, then apply whatever attributes you want to the new style.
The Style objects are hierarchical in the sense that two style attributes (Font and ForeBrush) don't need to be set. If these attributes are not set, they are inherited, but not from a parent Style object. Rather, these attributes are inherited from the parent UI object.
This type of inheritance make it easy to define a font on a Style associated with a parent UI object and have that font be automatically applied to all UI objects contained in the parent. By contrast, a BackBrush attribute is not explicitly inherited. Instead, the parent UI object paints its client area with a brush, and child UI objects have a transparent background by default, so the parent background shows through by default. Other attributes such as alignment, margins, padding, etc are also not inherited.
[TypeConverter(typeof(ExpandableObjectConverter))]
public class Style
Name | Description |
---|---|
Style() | Initializes a new instance of a Style. |
Style(string) | Initializes a new instance of a Style. |
Name | Description |
---|---|
SHADOW_SIZE | The size of shadow. |
Name | Description |
---|---|
BackBrush | Gets or sets the brush used to render the element background. |
BackBrushProvider | Gets or sets the brush provider used to render the element background. |
BackColor | Gets or sets the Color used to paint the background. |
BackColor2 | Gets or sets the secondary color used to build the background gradient. |
BackImage | Gets or sets the background image for the element. |
BackImageAlignment | Gets or sets the alignment used to render the background image. |
BackImageAllowFlip | Gets or sets whether the background image can be flipped for RTL mode. |
BackImagePadding | Gets or sets the thickness of the padding between the element edges and its content. |
BackImagePaddingRtl | Returns back image padding which honors current RightToLeft settings. |
BackImageScaling | Gets or sets the scaling used to render the background image. |
Border | Gets or sets the thickness of the border around the element. |
BorderBrush | Gets or sets the brush used to paint the borders around the element. |
BorderColor | Gets or sets the Color used to draw the border around the element. |
BorderEdges | Gets BorderEdges object that defines the colors used to paint each edge of the borders. |
BorderRtl | Returns padding which honors current RightToLeft settings. |
ChildSpacing | Gets or sets the amount of space between child elements. |
Clip | Gets or sets whether text content should be clipped to the element area. |
Corners | Gets or sets the radii of the element corners. |
Cursor | Gets or sets the cursor that should be displayed when the mouse is over elements with this style. |
DefaultStyle | Gets a reference to the default style. |
Disabled | Gets or sets the style to be used when the element is disabled. |
DisplayBlock | Gets or sets the display as block or inline of the element. |
Ellipse | Gets or sets whether the element border is an ellipse (for the dynamic styles only). |
Flags | Gets or sets the style flags. |
Font | Gets or sets the font used to paint text within the element. |
FontPadding | Gets or sets whether text bounding rectangle should include padding. |
ForeBrush | Gets or sets the brush used to paint the text within the element. |
ForeColor | Gets or sets the Color used to paint the text. |
Format | Gets or sets the format string used to convert the element value into a string. |
GammaCorrection | Gets or sets whether to apply gamma correction to the background gradient. |
GradientBlend | Gets or sets the Blend used to paint the background gradient. |
GradientCenter | Gets or sets the PointF that represents the center of a radial gradient background in percentage units. |
GradientInterpolationColors | Gets or sets a ColorBlend that defines a multicolor gradient. |
GradientMode | Gets or sets the GradientMode used to paint the background. |
Height | Gets or sets the style height (set to -1 to use the default height). |
HorizontalAlignment | Gets or sets how elements should be aligned in the horizontal direction. |
Hot | Gets or sets the style to be used when the element is hot. |
HotPressed | Gets or sets the style to be used when the element is hot and pressed. |
HotkeyPrefix | Gets or sets the HotkeyPrefix value determining how to display hot keys. |
ImageAlignment | Gets or sets how images should be aligned within the element. |
ImageAllowFlip | Gets or sets whether the image should be flipped horizontally for RTL mode. |
ImageScaling | Gets or sets how images should be scaled within the element. |
Indent | Gets or sets the indentation for the first text element. |
Locked | Gets or sets whether the style is locked and cannot be modified. |
Margins | Gets or sets the thickness of the margins around the element. |
MarginsRtl | Returns margins which honor current RightToLeft settings. |
Name | Gets or sets the style name. |
Owner | Gets the owner object, such an XStyleSet. |
Padding | Gets or sets the thickness of the padding between the element edges and its content. |
PaddingRtl | Returns padding which honors current RightToLeft settings. |
Pressed | Gets or sets the style to be used when the element is pressed. |
Shadow | Gets or sets whether the style includes a shadow. |
TextDirection | Gets or sets the direction in which text is rendered. |
Trimming | Gets or sets how to trim characters that do not fit in the space available. |
VerticalAlignment | Gets or sets how elements should be aligned in the vertical direction. |
Width | Gets or sets the style width (set to -1 to use the default width). |
WordWrap | Gets or sets whether text should be allowed to wrap within the element. |
Name | Description |
---|---|
BrushFromColor(Color) | Returns new SolidBrush if specified color is not Transparent or null otherwise. |
Clone() | Creates an instance of the Style class that is identical to the current Style (except for the Locked property, which is always false for clones). |
ColorFromBrush(Brush) | Returns Color if specified brush is a SolidBrush or Transparent otherwise. |
Copy(Style) | Copies all attributes from another Style object. |
Deflate(Rectangle) | Deflates the specified Rectangle by the values of the current Style margins, padding and border. |
Deflate(Size) | Deflates the specified Size by the values of the current Style margins, padding and border. |
Deflate(int, int) | Deflates the specified width and height by the values of the current Style margins, padding and border. |
DeflateHeight(int) | Deflates the specified height by the values of the current Style margins, padding and border. |
DeflateWidth(int) | Deflates the specified width by the values of the current Style margins, padding and border. |
Dispose() | Releases all resources. |
FormatValue(object) | Converts value to string according to Format property value. |
HasShadow() | Gets whether this style or any of its sub-styles has a shadow. |
Inflate(Rectangle) | Inflates the specified Rectangle by the values of the current Style margins, padding and border. |
Inflate(Size) | Inflates the specified Size by the values of the current Style margins, padding and border. |
Inflate(int, int) | Inflates the specified width and height by the values of the current Style margins, padding and border. |
InflateHeight(int) | Inflates the specified height by the values of the current Style margins, padding and border. |
InflateWidth(int) | Inflates the specified width by the values of the current Style margins, padding and border. |
Merge(Style) | Copies attributes set to non-default values from another Style object. |
OnStyleChanged(EventArgs) | Raises the StyleChanged event. |
Name | Description |
---|---|
StyleChanged | Fires when any elements of the Style change. |