Show / Hide Table of Contents

Class MTBase

Base class of popupMenu and toolbar.

public abstract class MTBase
Remarks

image argument of "add item" functions can be:

  • icon name, like "*Pack.Icon color" (you can get it from the Icons tool). See ImageUtil.LoadWpfImageElement.
  • file/folder path (string) - the "show" function calls icon.of to get its icon. It also supports file type icons like ".txt", etc.
  • file path with prefix "imagefile:" or resource path that starts with "resources/" or has prefix "resource:" - the "show" function loads .png or .xaml image file or resource.
  • string with prefix "image:" - Base64 encoded image file. Can be created with the Find image tool.
  • FolderPath - same as folder path string.
  • System.Drawing.Image - image.
  • icon - icon. The "add item" function disposes it.
  • StockIcon - the "show" function calls icon.stock.
  • null - if MTBase.ExtractIconPathFromCodetrue, the "show" function tries to extract a file path from action code; then calls icon.of. Else no image.
  • string "" - no image, even if ExtractIconPathFromCodetrue.

Item images should be of size 16x16 (small icon size). If high DPI, will scale images automatically, which makes them slightly blurred. To avoid scaling, can be used XAML images, but then slower.

Images are loaded on demand, when showing the menu or submenu etc. If fails to load, prints warning (print.warning).

For icon/image files use full path, unless they are in folders.ThisAppImages

To add an image resource in Visual Studio, use build action Resource for the image file.


Namespace: Au.Types
Assembly: Au.dll
Inheritance
object
MTBase
popupMenu
toolbar

Properties

Name Description
ActionException

Whether to handle exceptions in item action code. If false (default), handles exceptions and on exception calls print.warning. This property is applied to items added afterwards; submenus inherit it.

ActionThread

Execute item actions asynchronously in new threads. This property is applied to items added afterwards; submenus inherit it.

ExtractIconPathFromCode

Extract file path or script path from item action code (for example run.it or script.run argument) and use icon of that file or script. This property is applied to items added afterwards; submenus inherit it.

ImageSize

Width and height of images. Default 16, valid 16-256.

PathInTooltip

If an item has file path, show it in tooltip. This property is applied to items added afterwards; submenus inherit it.