DekGenius.com
[ Team LiB ] Previous Section Next Section

ToolboxBitmapAttribute

System.Drawing (system.drawing.dll)class

This Attribute class is something of a refugee from the System.Drawing.Design namespace. If you apply the attribute to a component and specify either the filename of a 16 x 16 bitmap, or a component type (e.g., typeof(SomeOtherComponent)), the appropriate image (either your bitmap or the image specified for the other type) will be displayed in the designer toolbox next to your component's name.

You can also specify both, and it will fallback on the type imagery if the bitmap file doesn't exist.

This is, of course, extremely useful; but what it is doing in this namespace is a mystery.

public class ToolboxBitmapAttribute : Attribute {
// Public Constructors
   public ToolboxBitmapAttribute(string imageFile);
   public ToolboxBitmapAttribute(Type t);
   public ToolboxBitmapAttribute(Type t, string name);
// Public Static Fields
   public static readonly ToolboxBitmapAttribute Default;  // =System.Drawing.ToolboxBitmapAttribute
// Public Static Methods
   public static Image GetImageFromResource(Type t, string imageName, bool large);
// Public Instance Methods
   public override bool Equals(object value);  // overrides Attribute
   public override int GetHashCode();  // overrides Attribute
   public Image GetImage(object component);
   public Image GetImage(object component, bool large);
   public Image GetImage(Type type);
   public Image GetImage(Type type, bool large);
   public Image GetImage(Type type, string imgName, bool large);
}

Hierarchy

System.Object System.Attribute ToolboxBitmapAttribute

Valid On

Class

    [ Team LiB ] Previous Section Next Section