C# Класс ComponentFactory.Krypton.Toolkit.CommonHelper

Set of common helper routines for the Toolkit
Показать файл Открыть проект

Открытые методы

Метод Описание
AddControlToParent ( Control parent, Control c ) : void

Add the provided control to a parent collection.

ApplyPadding ( Orientation orientation, Rectangle rect, Padding padding ) : Rectangle

Return the provided rectangle with orientation specific padding applied.

ApplyPadding ( VisualOrientation orientation, Rectangle rect, Padding padding ) : Rectangle

Return the provided rectangle with visual orientation specific padding applied.

ApplyPadding ( Orientation orientation, Size size, Padding padding ) : Size

Return the provided size with orientation specific padding applied.

ApplyPadding ( VisualOrientation orientation, Size size, Padding padding ) : Size

Return the provided size with visual orientation specific padding applied.

BlackenColor ( Color color1, float percentR, float percentG, float percentB ) : Color

Blacken a provided color by applying per channel percentages.

BoolToString ( bool b ) : string

Convert a Boolean to a culture invariant string value.

ButtonStyleToPalette ( ButtonStyle style ) : PaletteButtonStyle

Convert from ButtonStyle to PaletteButtonStyle.

CheckContextMenuForShortcut ( ContextMenuStrip cms, Message &msg, Keys keyData ) : bool

Check a short cut menu for a matching short and invoke that item if found.

ClientMouseMessageToScreenPt ( Message m ) : Point

Convert a client mouse position inside a windows message into a screen position.

ColorDepth ( ) : int

Get the number of bits used to define the color depth of the display.

ColorToBlackAndWhite ( Color color ) : Color

Convert the color to a black and white color.

ColorToString ( Color c ) : string

Convert a Color to a culture invariant string value.

ContentStyleFromLabelStyle ( LabelStyle style ) : PaletteContentStyle

Find the appropriate content style to match the incoming label style.

CreateInstance ( Type itemType, IDesignerHost host ) : object

Create new instance of specified type within the designer host, if provided.

DesignMode ( Component c ) : bool

Discover if the component is in design mode.

DestroyInstance ( object instance, IDesignerHost host ) : void

Destroy instance of an object using the provided designer host.

DoubleToString ( double d ) : string

Convert a double to a culture invariant string value.

GetControlWithFocus ( Control control ) : Control

Search the hierarchy of the provided control looking for one that has the focus.

GetRightToLeftLayout ( Control control ) : bool

Gets the form level right to left setting.

GetWindowBorders ( CreateParams cp ) : Padding

Gets the size of the borders requested by the real window.

ImageToXmlCData ( XmlWriter xmlWriter, string name, Image image ) : void

Convert a Image to a culture invariant string value.

IsFormMaximized ( Form f ) : bool

Discover if the provided Form is currently maximized.

IsFormMinimized ( Form f ) : bool

Discover if the provided Form is currently minimized.

LogOutput ( string str ) : void

Output some debug data to a log file that exists in same directory as the application.

MakeCustomDateFormat ( string format ) : string

Ensure that a single character format string is treated as a custom format.

MergeColors ( Color color1, float percent1, Color color2, float percent2 ) : Color

Merge two colors together using relative percentages.

MergeColors ( Color color1, float percent1, Color color2, float percent2, Color color3, float percent3 ) : Color

Merge three colors together using relative percentages.

OrientateDrawBorders ( PaletteDrawBorders borders, VisualOrientation orientation ) : PaletteDrawBorders

Apply an orientation to the draw border edges to get a correct value.

OrientatePadding ( VisualOrientation orientation, Padding padding ) : Padding

Modify the incoming padding to reflect the visual orientation.

PaletteTextHintToRenderingHint ( PaletteTextHint hint ) : TextRenderingHint

Convert from palette rendering hint to actual rendering hint.

PerformOperation ( System.Operation op, object parameter ) : object

Perform operation in a worker thread with wait dialog in main thread.

PointToString ( Point s ) : string

Convert a Point to a culture invariant string value.

RealClientRectangle ( IntPtr handle ) : Rectangle

Gets the real client rectangle of the list.

RemoveControlFromParent ( Control c ) : void

Remove the provided control from its parent collection.

ReverseOrientateDrawBorders ( PaletteDrawBorders borders, VisualOrientation orientation ) : PaletteDrawBorders

Apply a reversed orientation so that when orientated again it comes out with the original value.

RoundedRectanglePath ( Rectangle rect, int rounding ) : GraphicsPath

Create a graphics path that describes a rounded rectangle.

SeparatorStyleToMetricPadding ( SeparatorStyle separatorStyle ) : PaletteMetricPadding

Get the correct metric padding for the provided separator style.

SizeToString ( Size s ) : string

Convert a Size to a culture invariant string value.

StringToBool ( string s ) : bool

Convert a culture invariant string value to a Boolean.

StringToColor ( string s ) : Color

Convert a culture invariant string value to a Color.

StringToDouble ( string s ) : double

Convert a culture invariant string value to a double.

StringToPoint ( string s ) : Point

Convert a culture invariant string value to a Point.

StringToSize ( string s ) : Size

Convert a culture invariant string value to a Size.

TextToXmlAttribute ( XmlWriter xmlWriter, string name, string value ) : void

Only persist the provided name/value pair as an Xml attribute if the value is not null or empty.

TextToXmlAttribute ( XmlWriter xmlWriter, string name, string value, string def ) : void

Only persist the provided name/value pair as an Xml attribute if the value is not null/empty and not the default.

ValidContextMenuStrip ( ContextMenuStrip cms ) : bool

Decide if the context menu strip should be displayed.

ValidKryptonContextMenu ( KryptonContextMenu kcm ) : bool

Decide if the KryptonContextMenu should be displayed.

VisualToOrientation ( VisualOrientation orientation ) : Orientation

Convert from VisualOrientation to Orientation.

WhitenColor ( Color color1, float percentR, float percentG, float percentB ) : Color

Whiten a provided color by applying per channel percentages.

XmlAttributeToText ( XmlReader xmlReader, string name ) : string

Read the named attribute value but if no attribute is found then an empty string.

XmlAttributeToText ( XmlReader xmlReader, string name, string def ) : string

Read the named attribute value but if no attribute is found then return the provided default.

XmlCDataToImage ( XmlReader xmlReader ) : Image

Convert a culture invariant string value into an Image.

Приватные методы

Метод Описание
HasABorder ( PaletteDrawBorders borders ) : bool
HasAllBorders ( PaletteDrawBorders borders ) : bool
HasBottomBorder ( PaletteDrawBorders borders ) : bool
HasLeftBorder ( PaletteDrawBorders borders ) : bool
HasNoBorders ( PaletteDrawBorders borders ) : bool
HasOneBorder ( PaletteDrawBorders borders ) : bool
HasRightBorder ( PaletteDrawBorders borders ) : bool
HasTopBorder ( PaletteDrawBorders borders ) : bool
IsOverrideState ( PaletteState state ) : bool
IsOverrideStateExclude ( PaletteState state, PaletteState exclude ) : bool
SwapRectangleSizes ( Rectangle &rect ) : void

Описание методов

AddControlToParent() публичный статический Метод

Add the provided control to a parent collection.
public static AddControlToParent ( Control parent, Control c ) : void
parent System.Windows.Forms.Control Parent control.
c System.Windows.Forms.Control Control to be added.
Результат void

ApplyPadding() публичный статический Метод

Return the provided rectangle with orientation specific padding applied.
public static ApplyPadding ( Orientation orientation, Rectangle rect, Padding padding ) : Rectangle
orientation Orientation Orientation to apply padding with.
rect System.Drawing.Rectangle Starting rectangle.
padding Padding Padding to be applied.
Результат System.Drawing.Rectangle

ApplyPadding() публичный статический Метод

Return the provided rectangle with visual orientation specific padding applied.
public static ApplyPadding ( VisualOrientation orientation, Rectangle rect, Padding padding ) : Rectangle
orientation VisualOrientation Orientation to apply padding with.
rect System.Drawing.Rectangle Starting rectangle.
padding Padding Padding to be applied.
Результат System.Drawing.Rectangle

ApplyPadding() публичный статический Метод

Return the provided size with orientation specific padding applied.
public static ApplyPadding ( Orientation orientation, Size size, Padding padding ) : Size
orientation Orientation Orientation to apply padding with.
size System.Drawing.Size Starting size.
padding Padding Padding to be applied.
Результат System.Drawing.Size

ApplyPadding() публичный статический Метод

Return the provided size with visual orientation specific padding applied.
public static ApplyPadding ( VisualOrientation orientation, Size size, Padding padding ) : Size
orientation VisualOrientation Orientation to apply padding with.
size System.Drawing.Size Starting size.
padding Padding Padding to be applied.
Результат System.Drawing.Size

BlackenColor() публичный статический Метод

Blacken a provided color by applying per channel percentages.
public static BlackenColor ( Color color1, float percentR, float percentG, float percentB ) : Color
color1 Color Color.
percentR float Percentage of red to keep.
percentG float Percentage of green to keep.
percentB float Percentage of blue to keep.
Результат Color

BoolToString() публичный статический Метод

Convert a Boolean to a culture invariant string value.
public static BoolToString ( bool b ) : string
b bool Boolean to convert.
Результат string

ButtonStyleToPalette() публичный статический Метод

Convert from ButtonStyle to PaletteButtonStyle.
public static ButtonStyleToPalette ( ButtonStyle style ) : PaletteButtonStyle
style ButtonStyle ButtonStyle to convert.
Результат PaletteButtonStyle

CheckContextMenuForShortcut() публичный статический Метод

Check a short cut menu for a matching short and invoke that item if found.
public static CheckContextMenuForShortcut ( ContextMenuStrip cms, Message &msg, Keys keyData ) : bool
cms System.Windows.Forms.ContextMenuStrip ContextMenuStrip instance to check.
msg System.Windows.Forms.Message Windows message that generated check.
keyData Keys Keyboard shortcut to check.
Результат bool

ClientMouseMessageToScreenPt() публичный статический Метод

Convert a client mouse position inside a windows message into a screen position.
public static ClientMouseMessageToScreenPt ( Message m ) : Point
m System.Windows.Forms.Message Window message.
Результат Point

ColorDepth() публичный статический Метод

Get the number of bits used to define the color depth of the display.
public static ColorDepth ( ) : int
Результат int

ColorToBlackAndWhite() публичный статический Метод

Convert the color to a black and white color.
public static ColorToBlackAndWhite ( Color color ) : Color
color Color Base color.
Результат Color

ColorToString() публичный статический Метод

Convert a Color to a culture invariant string value.
public static ColorToString ( Color c ) : string
c Color Color to convert.
Результат string

ContentStyleFromLabelStyle() публичный статический Метод

Find the appropriate content style to match the incoming label style.
public static ContentStyleFromLabelStyle ( LabelStyle style ) : PaletteContentStyle
style LabelStyle LabelStyle enumeration.
Результат PaletteContentStyle

CreateInstance() публичный статический Метод

Create new instance of specified type within the designer host, if provided.
public static CreateInstance ( Type itemType, IDesignerHost host ) : object
itemType System.Type Type of the item to create.
host IDesignerHost Designer host used if provided.
Результат object

DesignMode() публичный статический Метод

Discover if the component is in design mode.
public static DesignMode ( Component c ) : bool
c System.ComponentModel.Component Component to test.
Результат bool

DestroyInstance() публичный статический Метод

Destroy instance of an object using the provided designer host.
public static DestroyInstance ( object instance, IDesignerHost host ) : void
instance object Reference to item for destroying.
host IDesignerHost Designer host used if provided.
Результат void

DoubleToString() публичный статический Метод

Convert a double to a culture invariant string value.
public static DoubleToString ( double d ) : string
d double Double to convert.
Результат string

GetControlWithFocus() публичный статический Метод

Search the hierarchy of the provided control looking for one that has the focus.
public static GetControlWithFocus ( Control control ) : Control
control System.Windows.Forms.Control Top of the hierarchy to search.
Результат System.Windows.Forms.Control

GetRightToLeftLayout() публичный статический Метод

Gets the form level right to left setting.
public static GetRightToLeftLayout ( Control control ) : bool
control System.Windows.Forms.Control Control for which the setting is needed.
Результат bool

GetWindowBorders() публичный статический Метод

Gets the size of the borders requested by the real window.
public static GetWindowBorders ( CreateParams cp ) : Padding
cp System.Windows.Forms.CreateParams Window style parameters.
Результат Padding

ImageToXmlCData() публичный статический Метод

Convert a Image to a culture invariant string value.
public static ImageToXmlCData ( XmlWriter xmlWriter, string name, Image image ) : void
xmlWriter System.Xml.XmlWriter Xml writer to save information into.
name string Name of image to save.
image Image Image to persist.
Результат void

IsFormMaximized() публичный статический Метод

Discover if the provided Form is currently maximized.
public static IsFormMaximized ( Form f ) : bool
f System.Windows.Forms.Form Form reference.
Результат bool

IsFormMinimized() публичный статический Метод

Discover if the provided Form is currently minimized.
public static IsFormMinimized ( Form f ) : bool
f System.Windows.Forms.Form Form reference.
Результат bool

LogOutput() публичный статический Метод

Output some debug data to a log file that exists in same directory as the application.
public static LogOutput ( string str ) : void
str string String to output.
Результат void

MakeCustomDateFormat() публичный статический Метод

Ensure that a single character format string is treated as a custom format.
public static MakeCustomDateFormat ( string format ) : string
format string Incoming format.
Результат string

MergeColors() публичный статический Метод

Merge two colors together using relative percentages.
public static MergeColors ( Color color1, float percent1, Color color2, float percent2 ) : Color
color1 Color First color.
percent1 float Percentage of first color to use.
color2 Color Second color.
percent2 float Percentage of second color to use.
Результат Color

MergeColors() публичный статический Метод

Merge three colors together using relative percentages.
public static MergeColors ( Color color1, float percent1, Color color2, float percent2, Color color3, float percent3 ) : Color
color1 Color First color.
percent1 float Percentage of first color to use.
color2 Color Second color.
percent2 float Percentage of second color to use.
color3 Color Third color.
percent3 float Percentage of third color to use.
Результат Color

OrientateDrawBorders() публичный статический Метод

Apply an orientation to the draw border edges to get a correct value.
public static OrientateDrawBorders ( PaletteDrawBorders borders, VisualOrientation orientation ) : PaletteDrawBorders
borders PaletteDrawBorders Border edges to be drawn.
orientation VisualOrientation How to adjsut the border edges.
Результат PaletteDrawBorders

OrientatePadding() публичный статический Метод

Modify the incoming padding to reflect the visual orientation.
public static OrientatePadding ( VisualOrientation orientation, Padding padding ) : Padding
orientation VisualOrientation Orientation to apply to padding.
padding Padding Padding to be modified.
Результат Padding

PaletteTextHintToRenderingHint() публичный статический Метод

Convert from palette rendering hint to actual rendering hint.
public static PaletteTextHintToRenderingHint ( PaletteTextHint hint ) : TextRenderingHint
hint PaletteTextHint Palette rendering hint.
Результат TextRenderingHint

PerformOperation() публичный статический Метод

Perform operation in a worker thread with wait dialog in main thread.
public static PerformOperation ( System.Operation op, object parameter ) : object
op System.Operation Delegate of operation to be performed.
parameter object Parameter to be passed into the operation.
Результат object

PointToString() публичный статический Метод

Convert a Point to a culture invariant string value.
public static PointToString ( Point s ) : string
s Point Size to convert.
Результат string

RealClientRectangle() публичный статический Метод

Gets the real client rectangle of the list.
public static RealClientRectangle ( IntPtr handle ) : Rectangle
handle System.IntPtr Window handle of the control.
Результат System.Drawing.Rectangle

RemoveControlFromParent() публичный статический Метод

Remove the provided control from its parent collection.
public static RemoveControlFromParent ( Control c ) : void
c System.Windows.Forms.Control Control to be removed.
Результат void

ReverseOrientateDrawBorders() публичный статический Метод

Apply a reversed orientation so that when orientated again it comes out with the original value.
public static ReverseOrientateDrawBorders ( PaletteDrawBorders borders, VisualOrientation orientation ) : PaletteDrawBorders
borders PaletteDrawBorders Border edges to be drawn.
orientation VisualOrientation How to adjsut the border edges.
Результат PaletteDrawBorders

RoundedRectanglePath() публичный статический Метод

Create a graphics path that describes a rounded rectangle.
public static RoundedRectanglePath ( Rectangle rect, int rounding ) : GraphicsPath
rect System.Drawing.Rectangle Rectangle to become rounded.
rounding int The rounding factor to apply.
Результат System.Drawing.Drawing2D.GraphicsPath

SeparatorStyleToMetricPadding() публичный статический Метод

Get the correct metric padding for the provided separator style.
public static SeparatorStyleToMetricPadding ( SeparatorStyle separatorStyle ) : PaletteMetricPadding
separatorStyle SeparatorStyle Separator style.
Результат PaletteMetricPadding

SizeToString() публичный статический Метод

Convert a Size to a culture invariant string value.
public static SizeToString ( Size s ) : string
s System.Drawing.Size Size to convert.
Результат string

StringToBool() публичный статический Метод

Convert a culture invariant string value to a Boolean.
public static StringToBool ( string s ) : bool
s string String to convert.
Результат bool

StringToColor() публичный статический Метод

Convert a culture invariant string value to a Color.
public static StringToColor ( string s ) : Color
s string String to convert.
Результат Color

StringToDouble() публичный статический Метод

Convert a culture invariant string value to a double.
public static StringToDouble ( string s ) : double
s string String to convert.
Результат double

StringToPoint() публичный статический Метод

Convert a culture invariant string value to a Point.
public static StringToPoint ( string s ) : Point
s string String to convert.
Результат Point

StringToSize() публичный статический Метод

Convert a culture invariant string value to a Size.
public static StringToSize ( string s ) : Size
s string String to convert.
Результат System.Drawing.Size

TextToXmlAttribute() публичный статический Метод

Only persist the provided name/value pair as an Xml attribute if the value is not null or empty.
public static TextToXmlAttribute ( XmlWriter xmlWriter, string name, string value ) : void
xmlWriter System.Xml.XmlWriter Xml writer to save information into.
name string Attribute name.
value string Attribute value.
Результат void

TextToXmlAttribute() публичный статический Метод

Only persist the provided name/value pair as an Xml attribute if the value is not null/empty and not the default.
public static TextToXmlAttribute ( XmlWriter xmlWriter, string name, string value, string def ) : void
xmlWriter System.Xml.XmlWriter Xml writer to save information into.
name string Attribute name.
value string Attribute value.
def string Default value.
Результат void

ValidContextMenuStrip() публичный статический Метод

Decide if the context menu strip should be displayed.
public static ValidContextMenuStrip ( ContextMenuStrip cms ) : bool
cms System.Windows.Forms.ContextMenuStrip Reference to context menu strip.
Результат bool

ValidKryptonContextMenu() публичный статический Метод

Decide if the KryptonContextMenu should be displayed.
public static ValidKryptonContextMenu ( KryptonContextMenu kcm ) : bool
kcm KryptonContextMenu Reference to context menu strip.
Результат bool

VisualToOrientation() публичный статический Метод

Convert from VisualOrientation to Orientation.
public static VisualToOrientation ( VisualOrientation orientation ) : Orientation
orientation VisualOrientation VisualOrientation value.
Результат Orientation

WhitenColor() публичный статический Метод

Whiten a provided color by applying per channel percentages.
public static WhitenColor ( Color color1, float percentR, float percentG, float percentB ) : Color
color1 Color Color.
percentR float Percentage of red to keep.
percentG float Percentage of green to keep.
percentB float Percentage of blue to keep.
Результат Color

XmlAttributeToText() публичный статический Метод

Read the named attribute value but if no attribute is found then an empty string.
public static XmlAttributeToText ( XmlReader xmlReader, string name ) : string
xmlReader XmlReader Xml reader to load information from.
name string Attribute name.
Результат string

XmlAttributeToText() публичный статический Метод

Read the named attribute value but if no attribute is found then return the provided default.
public static XmlAttributeToText ( XmlReader xmlReader, string name, string def ) : string
xmlReader XmlReader Xml reader to load information from.
name string Attribute name.
def string Default value.
Результат string

XmlCDataToImage() публичный статический Метод

Convert a culture invariant string value into an Image.
public static XmlCDataToImage ( XmlReader xmlReader ) : Image
xmlReader XmlReader Xml reader to load information from.
Результат Image