Table of Contents

Class CadPluginIcon

Namespace
OpenCAD2D.Plugins
Assembly
OpenCAD2D.Core.dll

The picture of a ribbon button or a DRAWINGS button, described without WPF: path data, or the bytes of an image. The bytes are copied in when the icon is made, so that it keeps no stream, no file lock and no reference to the plugin's assembly, which unloading the plugin needs. The window draws it fitted into 32 pixels on a large button and 16 on a standard one; a raster icon of 16 by 16 is drawn as it is on a standard button.

public sealed class CadPluginIcon
Inheritance
CadPluginIcon
Inherited Members

Properties

Image

Gets the bytes of an icon made from an image, as they were given; null for path data.

PathData

Gets the path data of an icon drawn as a path, as WPF writes it ("M5 12 L19 12"), on a square of 24 drawn 2 wide like the presenter's own icons; null for an image.

Methods

FromFile(string)

Makes an icon from an image file, its bytes read and copied at once, so that the file is not held open and can be deleted or replaced. A plugin names a file beside it with Path.Combine(host.Folder, "circle16.png").

FromImage(byte[])

Makes an icon from the bytes of an image file: PNG, BMP, JPEG, GIF or ICO. The bytes are copied.

FromPathData(string)

Makes an icon from path data on a square of 24, drawn 2 wide: FromPathData("M4 12 H20 M12 4 V20") is a plus.

FromResource(Assembly, string)

Makes an icon from an image the assembly embeds, its bytes read and copied at once. The name is the resource's full name, "MyPlugin.circle16.png" for circle16.png of a project whose root namespace is MyPlugin.