EtoFormsMenuExtensionMethods
Provides extension methods for Eto.Forms.Menu and Eto.Forms.ContextMenu.
Methods
public static StackLayoutItem AddWithLabel(this Collection<StackLayoutItem> items, string text, string[] labels, Control control, bool expand = false)
Add a control with a leading label to a stack layout collection.
Parameters:
| items (Collection<StackLayoutItem>) | Collection to append to. |
| text (string) | Label text. |
| labels (string[]) | If not null, collection of all labels for horizontal sizing. |
| control (Control) | Control to host to the right of the label. |
| expand (bool = false) | Expansion state. |
Returns: Layout item which was inserted.
public static Color CellBackColor(this CellPaintEventArgs args, TreeGridView grid)
Try to figure out the background colour of a specific cell.
Parameters:
| args (CellPaintEventArgs) | |
| grid (TreeGridView) |
Compute the line height of a font in logical pixels. This method is better than the Font.LineHeight property on Font as that one behaves differently on Windows and MacOS.
Parameters:
| font (Font) |
Invoke a specific method delegate on the UI thread using a default delay of 20 milliseconds.
Parameters:
| control (Control) | UI object. |
| action (Action) | Delegate to invoke. |
Invoke a specific method delegate on the UI thread.
Invoke a specific method delegate on the UI thread using a default delay of 20 milliseconds.
Parameters:
| control (Control) | UI object. |
| action (Action<T>) | Delegate to invoke. |
| value (T) | Method argument. |
Invoke a specific method delegate on the UI thread.
public static void InvalidateSafe(this Control control)
Invalidate a control using thread-safe methods.
Parameters:
| control (Control) | Control to invalidate. |
public static Font Italicize(this Font font)
Ensure a font is italic. This method will not create a new font if not needed.
Parameters:
| font (Font) |
public static void LimitFormToScreen(this Form form)
Limit a form to be entirely within the bounds of whichever screen it is associated with.
If the form is already visible, it will be moved.
If the form is still being constructed, it will be moved as soon as possible, hopefully before it is drawn wrongly once.
Parameters:
| form (Form) | Form to limit. |
public static MouseEventArgs Map(this MouseEventArgs args, IFlexControl control, CoordinateSystem system)
Transform a mouse event from control coordinates into content coordinates.
Parameters:
| args (MouseEventArgs) | Arguments to transform. |
| control (IFlexControl) | Relevant control. |
| system (CoordinateSystem) | Coordinate system. |
Returns: Transformed arguments.
Transform a mouse event from control coordinates into content coordinates.
Parameters:
| args (MouseEventArgs) | Arguments to transform. |
| control (IFlexControl) | Relevant control. |
Returns: Transformed arguments.
Resize a font.
Parameters:
| font (Font) | Font to resize. |
| newSize (float) | New size. |
Returns: Adjusted font or the same font if no resizing was needed.
public static DialogResult Show(this OpenFileDialog dialog, Window parent = null)
Show an Open File dialog in an OS-appropriate way. I.e. on OSX no parent window is assigned, allowing the dialog to be dragged, on Windows either the provided parent, or the Grasshopper Editor, or the Rhino window is assigned.
Parameters:
| dialog (OpenFileDialog) | |
| parent (Window = null) |
public static DialogResult Show(this SaveFileDialog dialog, Window parent = null)
Show a Save File dialog in an OS-appropriate way. I.e. on OSX no parent window is assigned, allowing the dialog to be dragged, on Windows either the provided parent, or the Grasshopper Editor, or the Rhino window is assigned.
Parameters:
| dialog (SaveFileDialog) | |
| parent (Window = null) |
public static Font ToggleBold(this Font font)
Toggle the bold flag of a font.
Parameters:
| font (Font) |