ToolboxBitmapAttribute.GetImage Method

Definition

Gets the small or large Image associated with this ToolboxBitmapAttribute object.

Overloads

GetImage(Object)

Gets the small Image associated with this ToolboxBitmapAttribute object.

GetImage(Type)

Gets the small Image associated with this ToolboxBitmapAttribute object.

GetImage(Object, Boolean)

Gets the small or large Image associated with this ToolboxBitmapAttribute object.

GetImage(Type, Boolean)

Gets the small or large Image associated with this ToolboxBitmapAttribute object.

GetImage(Type, String, Boolean)

Gets the small or large Image associated with this ToolboxBitmapAttribute object.

GetImage(Object)

Source:
ToolboxBitmapAttribute.cs
Source:
ToolboxBitmapAttribute.cs
Source:
ToolboxBitmapAttribute.cs
Source:
ToolboxBitmapAttribute.cs
Source:
ToolboxBitmapAttribute.cs
Source:
ToolboxBitmapAttribute.cs

Gets the small Image associated with this ToolboxBitmapAttribute object.

C#
public System.Drawing.Image? GetImage(object? component);
C#
public System.Drawing.Image GetImage(object component);

Parameters

component
Object

If this ToolboxBitmapAttribute object does not already have a small image, this method searches for a bitmap resource in the assembly that defines the type of the object specified by the component parameter. For example, if you pass an object of type ControlA to the component parameter, then this method searches the assembly that defines ControlA.

Returns

The small Image associated with this ToolboxBitmapAttribute object.

Examples

The following example demonstrates how to use the GetImage method.

C#
private Image GetImageOfCustomControl(Control userControl)
{
    Image controlImage = null;
    AttributeCollection attrCol = 
            TypeDescriptor.GetAttributes(userControl);
    ToolboxBitmapAttribute imageAttr = (ToolboxBitmapAttribute)
        attrCol[typeof(ToolboxBitmapAttribute)];
    if (imageAttr != null)
    {
        controlImage = imageAttr.GetImage(userControl);
    }

    return controlImage;
}

Remarks

This method searches for a resource named namespace.classname.bmp, where namespace is the namespace containing the definition of the type of the object specified by the component parameter. For example, suppose you pass an object of type ControlA to the component parameter. If ControlA is in NamespaceA in AssemblyA.dll, then this method searches AssemblyA.dll for a resource named NamespaceA.ControlA.bmp.

Applies to

.NET 10 (package-provided) ja muut versiot
Tuote Versiot
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

GetImage(Type)

Source:
ToolboxBitmapAttribute.cs
Source:
ToolboxBitmapAttribute.cs
Source:
ToolboxBitmapAttribute.cs
Source:
ToolboxBitmapAttribute.cs
Source:
ToolboxBitmapAttribute.cs
Source:
ToolboxBitmapAttribute.cs

Gets the small Image associated with this ToolboxBitmapAttribute object.

C#
public System.Drawing.Image? GetImage(Type type);
C#
public System.Drawing.Image GetImage(Type type);

Parameters

type
Type

If this ToolboxBitmapAttribute object does not already have a small image, this method searches for a bitmap resource in the assembly that defines the type specified by the type parameter. For example, if you pass typeof(ControlA) to the type parameter, then this method searches the assembly that defines ControlA.

Returns

The small Image associated with this ToolboxBitmapAttribute object.

Remarks

This method searches for a resource named namespace.classname.bmp, where namespace is the namespace containing the definition of the type specified by the type parameter. For example, suppose you pass typeof(ControlA) to the type parameter. If ControlA is in NamespaceA in AssemblyA.dll, then this method searches AssemblyA.dll for a resource named NamespaceA.ControlA.bmp.

Applies to

.NET 10 (package-provided) ja muut versiot
Tuote Versiot
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

GetImage(Object, Boolean)

Source:
ToolboxBitmapAttribute.cs
Source:
ToolboxBitmapAttribute.cs
Source:
ToolboxBitmapAttribute.cs
Source:
ToolboxBitmapAttribute.cs
Source:
ToolboxBitmapAttribute.cs
Source:
ToolboxBitmapAttribute.cs

Gets the small or large Image associated with this ToolboxBitmapAttribute object.

C#
public System.Drawing.Image? GetImage(object? component, bool large);
C#
public System.Drawing.Image GetImage(object component, bool large);

Parameters

component
Object

If this ToolboxBitmapAttribute object does not already have a small image, this method searches for a bitmap resource in the assembly that defines the type of the object specified by the component parameter. For example, if you pass an object of type ControlA to the component parameter, then this method searches the assembly that defines ControlA.

large
Boolean

Specifies whether this method returns a large image (true) or a small image (false). The small image is 16 by 16, and the large image is 32 by 32.

Returns

An Image object associated with this ToolboxBitmapAttribute object.

Remarks

This method searches for a resource named namespace.classname.bmp, where namespace is the namespace containing the definition of the type of the object specified by the component parameter. For example, suppose you pass an object of type ControlA to the component parameter. If ControlA is in NamespaceA in AssemblyA.dll, then this method searches AssemblyA.dll for a resource named NamespaceA.ControlA.bmp.

If this ToolboxBitmapAttribute object does not already have a large image, this method creates a large image by scaling the small image.

Applies to

.NET 10 (package-provided) ja muut versiot
Tuote Versiot
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

GetImage(Type, Boolean)

Source:
ToolboxBitmapAttribute.cs
Source:
ToolboxBitmapAttribute.cs
Source:
ToolboxBitmapAttribute.cs
Source:
ToolboxBitmapAttribute.cs
Source:
ToolboxBitmapAttribute.cs
Source:
ToolboxBitmapAttribute.cs

Gets the small or large Image associated with this ToolboxBitmapAttribute object.

C#
public System.Drawing.Image? GetImage(Type type, bool large);
C#
public System.Drawing.Image GetImage(Type type, bool large);

Parameters

type
Type

If this ToolboxBitmapAttribute object does not already have a small image, this method searches for a bitmap resource in the assembly that defines the type specified by the component type. For example, if you pass typeof(ControlA) to the type parameter, then this method searches the assembly that defines ControlA.

large
Boolean

Specifies whether this method returns a large image (true) or a small image (false). The small image is 16 by 16, and the large image is 32 by 32.

Returns

An Image associated with this ToolboxBitmapAttribute object.

Remarks

This method searches for a resource named namespace.classname.bmp, where namespace is the namespace containing the definition of the type specified by the type parameter. For example, suppose you pass an typeof(ControlA) to the type parameter. If ControlA is in NamespaceA in AssemblyA.dll, then this method searches AssemblyA.dll for a resource named NamespaceA.ControlA.bmp.

If this ToolboxBitmapAttribute object does not already have a large image, this method creates a large image by scaling the small image.

Applies to

.NET 10 (package-provided) ja muut versiot
Tuote Versiot
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

GetImage(Type, String, Boolean)

Source:
ToolboxBitmapAttribute.cs
Source:
ToolboxBitmapAttribute.cs
Source:
ToolboxBitmapAttribute.cs
Source:
ToolboxBitmapAttribute.cs
Source:
ToolboxBitmapAttribute.cs
Source:
ToolboxBitmapAttribute.cs

Gets the small or large Image associated with this ToolboxBitmapAttribute object.

C#
public System.Drawing.Image? GetImage(Type type, string? imgName, bool large);
C#
public System.Drawing.Image GetImage(Type type, string imgName, bool large);

Parameters

type
Type

If this ToolboxBitmapAttribute object does not already have a small image, this method searches for an embedded bitmap resource in the assembly that defines the type specified by the component type. For example, if you pass typeof(ControlA) to the type parameter, then this method searches the assembly that defines ControlA.

imgName
String

The name of the embedded bitmap resource.

large
Boolean

Specifies whether this method returns a large image (true) or a small image (false). The small image is 16 by 16, and the large image is 32 by 32.

Returns

An Image associated with this ToolboxBitmapAttribute object.

Remarks

This method searches for a resource named namespace.imgName, where namespace is the namespace containing the definition of the type specified by the type parameter. For example, suppose you pass typeof(ControlA) to the type parameter and that you passed "MyBitmap.bmp" to the imgName parameter. If ControlA is in NamespaceA in AssemblyA.dll, then this method searches AssemblyA.dll for a resource named NamespaceA.MyBitmap.bmp.

If this ToolboxBitmapAttribute object does not already have a large image, this method creates a large image by scaling the small image.

Applies to

.NET 10 (package-provided) ja muut versiot
Tuote Versiot
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10