ClassHtmlStyle
Represents a single HtmlStyle. This object can be used to help probe and do validation against Html styles. Has functionality to convert unit styles to int values and color styles to System.Drawing.Color.
Definition
Namespace:ArtOfTest.WebAii.Controls.HtmlControls
Assembly:ArtOfTest.WebAii.dll
Syntax:
public class HtmlStyle
Inheritance: objectHtmlStyle
Constructors
HtmlStyle(string, string)
Create a new HtmlStyle object.
Properties
Name
Gets the style name.
Methods
IsColor()
Whether the value of this style is a color value or not.
IsInt()
Whether the value of this style is an integer value or not.
IsSameColor(Color, Color)
Performs a simple color compare that only compares red/green/blue colors. Does not compare known color names or alpha blending.
Declaration
public static bool IsSameColor(Color colorA, Color colorB)
Parameters
colorA
Color A to compare
colorB
Color B to compare
Returns
True/False whether the two colors have identical RGB colors.
Remarks
Use this to compare colors instead of System.Color.Equals() to allow your compares to work across browsers. For example, IE returns colors as named colors (yellow, red ..etc) for computed styles where Mozilla always returns (rgb(x,y,z)). Using the HtmlStyle.ToColor and IsSameColor() can help abstract these differences and allow you to perform the compare across browsers.
ToColor()
Attempts to parse the style value as a color and return a System.Drawing.Color object that corresponds to the color style value.
Declaration
public Color ToColor()
Returns
The System.Drawing.Color object or Color.Empty if unable to parse the color.
ToHtmlColor(Color)
Translates a System.Drawing.Color to an Html color string.