Class Utils
Provides various windows functionality
Inheritance
Inherited Members
Namespace: Azos.WinForms
Assembly: Azos.WinForms.dll
Syntax
public static class Utils
Methods
AllChildControls(Control)
Walks the whole child control tree and returns all controls as a flat enumeration
Declaration
public static IEnumerable<Control> AllChildControls(Control ctl)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | ctl |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<System.Windows.Forms.Control> |
CreateGrayscaleBitmap(Bitmap)
Converts a bitmap into grayscale mode
Declaration
public static Bitmap CreateGrayscaleBitmap(Bitmap fromBitmap)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Bitmap | fromBitmap |
Returns
Type | Description |
---|---|
System.Drawing.Bitmap |
DrawStringWithBackground(Graphics, String, Font, Brush, Brush, Int32, Int32)
Draws string on the background rectangle
Declaration
public static void DrawStringWithBackground(Graphics gr, string text, Font font, Brush textBrush, Brush backBrush, int x, int y)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | gr | |
System.String | text | |
System.Drawing.Font | font | |
System.Drawing.Brush | textBrush | |
System.Drawing.Brush | backBrush | |
System.Int32 | x | |
System.Int32 | y |
DrawTextHighlight(Graphics, Rectangle, Font, String, StringAlignment, Color)
Draws hand-drawn-looking highlighter color stick lines on top of text. The text itself is not drawn. Text may span multiple lines
Declaration
public static void DrawTextHighlight(Graphics gr, Rectangle rect, Font font, string text, StringAlignment align, Color color)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | gr | Graphical context |
System.Drawing.Rectangle | rect | Bounding rectangle |
System.Drawing.Font | font | Font to measure text in |
System.String | text | Text to measure, the text is not drawn rather charecters position is determined |
System.Drawing.StringAlignment | align | Text alignment |
System.Drawing.Color | color | Color of highlighter including opacity |
DrawUnderline(Graphics, Point, Int32, Color)
Draws an underline. Similar concept to VS or MS Word
Declaration
public static void DrawUnderline(Graphics gr, Point start, int length, Color color)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | gr | |
System.Drawing.Point | start | |
System.Int32 | length | |
System.Drawing.Color | color |
DrawUnderlineRectangle(Graphics, Rectangle, Color)
Draws a rectangle that looks like underline which looks similar to VS or MS Word
Declaration
public static void DrawUnderlineRectangle(Graphics gr, Rectangle rect, Color color)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | gr | |
System.Drawing.Rectangle | rect | |
System.Drawing.Color | color |
FocusWindowByText(String)
Declaration
public static void FocusWindowByText(string text)
Parameters
Type | Name | Description |
---|---|---|
System.String | text |
GetFocusedControl()
Returns focused .NET control or null
Declaration
public static Control GetFocusedControl()
Returns
Type | Description |
---|---|
System.Windows.Forms.Control |
IsControlDesignerHosted(Control)
Determines if control is being used within designer
Declaration
public static bool IsControlDesignerHosted(Control ctrl)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | ctrl |
Returns
Type | Description |
---|---|
System.Boolean |
SetUSCulture()
Initializes culture to US/English
Declaration
public static void SetUSCulture()