EtoFormsMenuExtensionMethods

public static class EtoFormsMenuExtensionMethods
Provides extension methods for Eto.Forms.Menu and Eto.Forms.ContextMenu.

Methods

AddItem

#Example
public static MenuItem AddItem(this ISubmenu menu, Command command)
Append an item to a menu.
menu (ISubmenu)Menu to append to.
command (Command)Item command.
Menu item that was added.

AddItem

#Example
public static MenuItem AddItem(this ISubmenu menu, string text, Command command)
Append an item to a menu.
menu (ISubmenu)Menu to append to.
text (string)Text of item.
command (Command)Item command.
Menu item that was added.

AddItem

#Example
public static MenuItem AddItem(this ISubmenu menu, string text, string description, Command command)
Append an item to a menu.
menu (ISubmenu)Menu to append to.
text (string)Text of item.
description (string)Description (tooltip) of item.
command (Command)Item command.
Menu item that was added.

AddLabel

#Example
public static MenuItem AddLabel(this ISubmenu menu, string text, string description = null)
Append a label to a menu.
menu (ISubmenu)Menu to append to.
text (string)Text of label.
description (string = null)Label tooltip.
Menu item that was added.

AddLabel

#Example
public static MenuItem AddLabel(this MenuItemCollection menu, string text, string description = null)
Append a label to a menu.
menu (MenuItemCollection)Menu to append to.
text (string)Text of label.
description (string = null)Label tooltip.
Menu item that was added.

AddSeparator

#Example
public static void AddSeparator(this ISubmenu menu)
Append an item to a menu.
menu (ISubmenu)Menu to append to.
Menu item that was added.

AddWithLabel

#Example
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.
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.
Layout item which was inserted.

CellBackColor

#Example
public static Color CellBackColor(this CellPaintEventArgs args, TreeGridView grid)
Try to figure out the background colour of a specific cell.
args (CellPaintEventArgs)
grid (TreeGridView)

ComputeLineHeight

#Example
public static float ComputeLineHeight(this Font font)
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.
font (Font)

DelayedInvoke

#Example
public static void DelayedInvoke(this Control control, Action action)
Invoke a specific method delegate on the UI thread using a default delay of 20 milliseconds.
control (Control)UI object.
action (Action)Delegate to invoke.

DelayedInvoke

#Example
public static void DelayedInvoke(this Control control, TimeSpan delay, Action action)
Invoke a specific method delegate on the UI thread.
control (Control)UI object.
delay (TimeSpan)Invoke delay.
action (Action)Delegate to invoke.

DelayedInvoke<T>

#Example
public static void DelayedInvoke<T>(this Control control, Action<T> action, T value)
Invoke a specific method delegate on the UI thread using a default delay of 20 milliseconds.
control (Control)UI object.
action (Action<T>)Delegate to invoke.
value (T)Method argument.

DelayedInvoke<T>

#Example
public static void DelayedInvoke<T>(this Control control, TimeSpan delay, Action<T> action, T value)
Invoke a specific method delegate on the UI thread.
control (Control)UI object.
delay (TimeSpan)Invoke delay.
action (Action<T>)Delegate to invoke.
value (T)Method argument.

InvalidateSafe

#Example
public static void InvalidateSafe(this Control control)
Invalidate a control using thread-safe methods.
control (Control)Control to invalidate.

Italicize

#Example
public static Font Italicize(this Font font)
Ensure a font is italic. This method will not create a new font if not needed.
font (Font)

LimitFormToScreen

#Example
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.

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.
args (MouseEventArgs)Arguments to transform.
control (IFlexControl)Relevant control.
system (CoordinateSystem)Coordinate system.
Transformed arguments.

MapToContent

#Example
public static MouseEventArgs MapToContent(this MouseEventArgs args, IFlexControl control)
Transform a mouse event from control coordinates into content coordinates.
args (MouseEventArgs)Arguments to transform.
control (IFlexControl)Relevant control.
Transformed arguments.

Resize

#Example
public static Font Resize(this Font font, float newSize)
Resize a font.
font (Font)Font to resize.
newSize (float)New size.
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.
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.
dialog (SaveFileDialog)
parent (Window = null)

ToggleBold

#Example
public static Font ToggleBold(this Font font)
Toggle the bold flag of a font.
font (Font)

ToggleItalic

#Example
public static Font ToggleItalic(this Font font)
Toggle the italic flag of a font.
font (Font)