Class UIUtils
A static class that contains methods to auto-convert rtl layout.
Inheritance
Namespace: FastReport.Utils
Assembly: FastReport.dll
Syntax
public static class UIUtils
Methods
CheckRTL(Control)
Changes control's layout to rtl.
Declaration
public static void CheckRTL(Control parent)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.Control | parent |
Dpi(Control)
Gets current dpi value for the control.
Declaration
public static int Dpi(this Control control)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.Control | control | The control. |
Returns
| Type | Description |
|---|---|
| System.Int32 | The dpi value. |
DpiMultiplier(Control)
Gets current dpi multiplier for the control (1.0 for 96dpi).
Declaration
public static float DpiMultiplier(this Control control)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.Control | control | The control. |
Returns
| Type | Description |
|---|---|
| System.Single | The dpi multiplier. |
DrawImageAndText(Control, DrawItemEventArgs, Image, String)
Draws an image and a text.
Declaration
public static void DrawImageAndText(this Control control, DrawItemEventArgs e, Image img, string text)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.Control | control | The control which is used to determine RTL and DPI settings. |
| System.Windows.Forms.DrawItemEventArgs | e | The draw event args. |
| System.Drawing.Image | img | The image. |
| System.String | text | The text. |
Remarks
This method is used to draw items in an owner-drawn listboxes and comboboxes. It respects RTL and DPI settings of a control.
DrawVisualStyleBorder(Control, Graphics, Rectangle)
Draws control's border.
Declaration
public static void DrawVisualStyleBorder(this Control control, Graphics graphics, Rectangle bounds)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.Control | control | The control. |
| System.Drawing.Graphics | graphics | The graphics. |
| System.Drawing.Rectangle | bounds | The bounds. |
FontDpiMultiplier(Control)
Gets current font dpi multiplier for the control (1.0 for 96dpi).
Declaration
public static float FontDpiMultiplier(this Control control)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.Control | control | The control. |
Returns
| Type | Description |
|---|---|
| System.Single | The font dpi multiplier. |
Remarks
The return value depends on the base resolution of the main screen.
GetImage(Control, Int32)
Returns an image from resources using control's dpi value.
Declaration
public static Image GetImage(this Control control, int index)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.Control | control | The control. |
| System.Int32 | index | Image index. |
Returns
| Type | Description |
|---|---|
| System.Drawing.Image | An image with specified index from "buttons.png" resource. |
GetImage(Control, String)
Returns an image from resources using control's dpi value.
Declaration
public static Image GetImage(this Control control, string name)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.Control | control | The control. |
| System.String | name | Image name. |
Returns
| Type | Description |
|---|---|
| System.Drawing.Image | An image with specified index from "buttons.png" resource. |
GetImages(Control)
Returns an imagelist from resources using control's dpi value.
Declaration
public static ImageList GetImages(this Control control)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.Control | control | The control. |
Returns
| Type | Description |
|---|---|
| System.Windows.Forms.ImageList | An imagelist from "buttons.png" resource. |
LogicalToDevice(Control, Font, Boolean)
Converts logical font to device font.
Declaration
public static Font LogicalToDevice(this Control control, Font value, bool disposeOriginal = false)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.Control | control | The control. |
| System.Drawing.Font | value | Logical font. |
| System.Boolean | disposeOriginal | Determines whether to dispose the original font or not. |
Returns
| Type | Description |
|---|---|
| System.Drawing.Font | Device font. |
LogicalToDevice(Control, Point)
Converts logical units to device units (pixels).
Declaration
public static Point LogicalToDevice(this Control control, Point value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.Control | control | The control. |
| System.Drawing.Point | value | Logical units. |
Returns
| Type | Description |
|---|---|
| System.Drawing.Point | Device units. |
LogicalToDevice(Control, Rectangle)
Converts logical units to device units (pixels).
Declaration
public static Rectangle LogicalToDevice(this Control control, Rectangle value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.Control | control | The control. |
| System.Drawing.Rectangle | value | Logical units. |
Returns
| Type | Description |
|---|---|
| System.Drawing.Rectangle | Device units. |
LogicalToDevice(Control, Size)
Converts logical units to device units (pixels).
Declaration
public static Size LogicalToDevice(this Control control, Size value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.Control | control | The control. |
| System.Drawing.Size | value | Logical units. |
Returns
| Type | Description |
|---|---|
| System.Drawing.Size | Device units. |
LogicalToDevice(Control, Int32)
Converts logical units to device units (pixels).
Declaration
public static int LogicalToDevice(this Control control, int value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.Control | control | The control. |
| System.Int32 | value | Logical units. |
Returns
| Type | Description |
|---|---|
| System.Int32 | Device units. |
LogicalToDevice(Control, Single)
Converts logical units to device units (pixels).
Declaration
public static float LogicalToDevice(this Control control, float value)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Windows.Forms.Control | control | The control. |
| System.Single | value | Logical units. |
Returns
| Type | Description |
|---|---|
| System.Single | Device units. |