EtoFormsMenuExtensionMethods

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

Methods

AddItem

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

AddItem

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

AddItem

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

AddLabel

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

AddLabel

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

AddSeparator

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

AddWithLabel

#Example
Add a control with a leading label to a stack layout collection.
public static StackLayoutItem AddWithLabel(
this Collection<StackLayoutItem>
items,
Collection to append to.
text,
Label text.
labels,
If not null, collection of all labels for horizontal sizing.
Control
control,
Control to host to the right of the label.
expand = false
Expansion state.
)
Layout item which was inserted.

CellBackColor

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

ComputeLineHeight

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

DelayedInvoke

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

DelayedInvoke

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

DelayedInvoke<T>

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

DelayedInvoke<T>

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

InvalidateSafe

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

Italicize

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

LimitFormToScreen

#Example

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.

public static void LimitFormToScreen(
this Form
form
Form to limit.
)
Transform a mouse event from control coordinates into content coordinates.
public static MouseEventArgs Map(
this MouseEventArgs
args,
Arguments to transform.
control,
Relevant control.
CoordinateSystem
system
Coordinate system.
)
Transformed arguments.

MapToContent

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

Resize

#Example
Resize a font.
public static Font Resize(
this Font
font,
Font to resize.
newSize
New size.
)
Adjusted font or the same font if no resizing was needed.
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.
public static DialogResult Show(
this OpenFileDialog
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.
public static DialogResult Show(
this SaveFileDialog
dialog,
Window
parent = null
)

ToggleBold

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

ToggleItalic

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