Class WinFormsUtils
Inheritance
Inherited Members
Namespace: Syncfusion.Windows.Forms
Assembly: Syncfusion.Shared.Base.dll
Syntax
public class WinFormsUtils
Constructors
WinFormsUtils()
Declaration
public WinFormsUtils()
Properties
MeasureEmptyCellString
Gets / sets the string used when doing a resize to fit for cells with empty text.
Declaration
public static string MeasureEmptyCellString { get; set; }
Property Value
Type |
---|
System.String |
Methods
ActivateAllParents(ContainerControl)
Makes the specified control and all its parent controls the ActiveControl of its parent container.
Declaration
public static bool ActivateAllParents(ContainerControl control)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.ContainerControl | control | The control that needs to be made the ActiveControl of its parent. |
Returns
Type |
---|
System.Boolean |
ChangeStyle(Control, ControlStyles, Boolean)
Sets / resets the specified styles on the control.
Declaration
public static void ChangeStyle(Control control, ControlStyles styles, bool setOrReset)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | control | The control on which to set / reset the styles. |
System.Windows.Forms.ControlStyles | styles | The style to set / reset. |
System.Boolean | setOrReset | Indicates whether to set / reset the style. True to set, False to reset. |
Remarks
This method uses reflection to call the protected SetStyle method on the specified control.
FindFile(String, String)
Finds a file of the given name in the current directory or sibling "Data" directory. If file is not found, the parent folder is checked until the file is found. This method is used by our samples when they load data from a separate "Data" folder.
Declaration
public static string FindFile(string dataDirName, string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.String | dataDirName | The name of the "Data" folder. |
System.String | fileName | The filename to be searched. |
Returns
Type | Description |
---|---|
System.String | The full path of the file that was found; an empty string is returned if file is not found. |
FocusedContainerControl()
Declaration
public static Control FocusedContainerControl()
Returns
Type |
---|
System.Windows.Forms.Control |
FocusedControl()
Declaration
public static Control FocusedControl()
Returns
Type |
---|
System.Windows.Forms.Control |
GetPropertyGridInControl(Control)
Returns the first PropertyGrid encountered in the container control's controls collection. Will recur.
Declaration
public static PropertyGrid GetPropertyGridInControl(Control control)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | control | The instance to a ContainerControl. |
Returns
Type | Description |
---|---|
System.Windows.Forms.PropertyGrid | A PropertyGrid instance, if found; NULL otherwise. |
IsActiveControlInParent(Control)
Declaration
public static bool IsActiveControlInParent(Control control)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | control |
Returns
Type |
---|
System.Boolean |
IsParent(Control, Control)
Declaration
public static bool IsParent(Control parent, Control child)
Parameters
Type | Name | Description |
---|---|---|
System.Windows.Forms.Control | parent | |
System.Windows.Forms.Control | child |
Returns
Type |
---|
System.Boolean |
MeasureSampleWString(Graphics, Font)
Returns the preferred size to be used for an empty cell.
Declaration
public static Size MeasureSampleWString(Graphics g, Font font)
Parameters
Type | Name | Description |
---|---|---|
System.Drawing.Graphics | g | The System.Drawing.Graphics context of the canvas. |
System.Drawing.Font | font | The System.Drawing.Font to be used. |
Returns
Type | Description |
---|---|
System.Drawing.Size | The System.Drawing.Size of the string "Wg;". |
UpdateDirectoryPath(OleDbConnection, String, String)
Updates the designer generated datasource full path to a different one based on the provided info.
Declaration
public static void UpdateDirectoryPath(OleDbConnection connection, string dataDirName, string fileName)
Parameters
Type | Name | Description |
---|---|---|
System.Data.OleDb.OleDbConnection | connection | The Connection object whose ConnectionString will be updated. |
System.String | dataDirName | The directory name that will be sought after up in the exe's hierarchy (typically the "Data" dir). |
System.String | fileName | A file in the above directory (typically an .mdb file). |
Remarks
The designer generated path to the "Data" directory could have been changed if the user installed the product to a non-default directory. This routine will parse up the dir hierarchy from the exe file and try to find the "Data" dir and use it instead.