ToolboxBitmapAttribute.GetImage メソッド

定義

このToolboxBitmapAttribute オブジェクトに関連付けられている小さいImageまたは大きいを取得します。

オーバーロード

名前 説明
GetImage(Object)

このToolboxBitmapAttribute オブジェクトに関連付けられている小さなImageを取得します。

GetImage(Type)

このToolboxBitmapAttribute オブジェクトに関連付けられている小さなImageを取得します。

GetImage(Object, Boolean)

このToolboxBitmapAttribute オブジェクトに関連付けられている小さいImageまたは大きいを取得します。

GetImage(Type, Boolean)

このToolboxBitmapAttribute オブジェクトに関連付けられている小さいImageまたは大きいを取得します。

GetImage(Type, String, Boolean)

このToolboxBitmapAttribute オブジェクトに関連付けられている小さいImageまたは大きいを取得します。

GetImage(Object)

このToolboxBitmapAttribute オブジェクトに関連付けられている小さなImageを取得します。

public:
 System::Drawing::Image ^ GetImage(System::Object ^ component);
public System.Drawing.Image GetImage(object component);
member this.GetImage : obj -> System.Drawing.Image
Public Function GetImage (component As Object) As Image

パラメーター

component
Object

この ToolboxBitmapAttribute オブジェクトに小さなイメージがない場合、このメソッドは、コンポーネント パラメーターで指定されたオブジェクトの型を定義するビットマップ リソースをアセンブリ内で検索します。 たとえば、ControlA 型のオブジェクトをコンポーネント パラメーターに渡すと、このメソッドは ControlA を定義するアセンブリを検索します。

返品

このToolboxBitmapAttribute オブジェクトに関連付けられている小さなImage

次の例では、 GetImage メソッドの使用方法を示します。

private:
    static Image^ GetImageOfCustomControl(Control^ userControl)
    {
        Image^ controlImage = nullptr;
        AttributeCollection^ attrCol =
            TypeDescriptor::GetAttributes(userControl);
        ToolboxBitmapAttribute^ imageAttr = (ToolboxBitmapAttribute^)
            attrCol[ToolboxBitmapAttribute::typeid];
        if (imageAttr != nullptr)
        {
            controlImage = imageAttr->GetImage(userControl);
        }

        return controlImage;
    }
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;
}
Private Function GetImageOfCustomControl(ByVal userControl As Control) As Image 
    Dim controlImage As Image = Nothing
    Dim attrCol As AttributeCollection = TypeDescriptor.GetAttributes(userControl)
    Dim imageAttr As ToolboxBitmapAttribute = _
        CType(attrCol(GetType(ToolboxBitmapAttribute)), ToolboxBitmapAttribute)
    If (imageAttr IsNot Nothing) Then
        controlImage = imageAttr.GetImage(userControl)
    End If
    
    Return controlImage

End Function

注釈

このメソッドは、namespace.classname.bmpという名前のリソースを検索します。名前空間は、 component パラメーターで指定されたオブジェクトの型の定義を含む名前空間です。 たとえば、ControlA 型のオブジェクトを component パラメーターに渡すとします。 ControlA が AssemblyA.dllの NamespaceA にある場合、このメソッドは NamespaceA.ControlA.bmpという名前のリソースを AssemblyA.dll 検索します。

適用対象

GetImage(Type)

このToolboxBitmapAttribute オブジェクトに関連付けられている小さなImageを取得します。

public:
 System::Drawing::Image ^ GetImage(Type ^ type);
public System.Drawing.Image GetImage(Type type);
member this.GetImage : Type -> System.Drawing.Image
Public Function GetImage (type As Type) As Image

パラメーター

type
Type

この ToolboxBitmapAttribute オブジェクトに小さなイメージがない場合、このメソッドは、型パラメーターで指定された型を定義するビットマップ リソースをアセンブリ内で検索します。 たとえば、typeof(ControlA) を型パラメーターに渡すと、このメソッドは ControlA を定義するアセンブリを検索します。

返品

このToolboxBitmapAttribute オブジェクトに関連付けられている小さなImage

注釈

このメソッドは、namespace.classname.bmpという名前のリソースを検索します。名前空間は、 type パラメーターで指定された型の定義を含む名前空間です。 たとえば、typeof(ControlA) を type パラメーターに渡すとします。 ControlA が AssemblyA.dllの NamespaceA にある場合、このメソッドは NamespaceA.ControlA.bmpという名前のリソースを AssemblyA.dll 検索します。

適用対象

GetImage(Object, Boolean)

このToolboxBitmapAttribute オブジェクトに関連付けられている小さいImageまたは大きいを取得します。

public:
 System::Drawing::Image ^ GetImage(System::Object ^ component, bool large);
public System.Drawing.Image GetImage(object component, bool large);
member this.GetImage : obj * bool -> System.Drawing.Image
Public Function GetImage (component As Object, large As Boolean) As Image

パラメーター

component
Object

この ToolboxBitmapAttribute オブジェクトに小さなイメージがない場合、このメソッドは、コンポーネント パラメーターで指定されたオブジェクトの型を定義するビットマップ リソースをアセンブリ内で検索します。 たとえば、ControlA 型のオブジェクトをコンポーネント パラメーターに渡すと、このメソッドは ControlA を定義するアセンブリを検索します。

large
Boolean

このメソッドが大きなイメージ (true) または小さなイメージ (false) を返すかどうかを指定します。 小さい画像は 16 ~ 16 で、大きな画像は 32 ~ 32 です。

返品

このToolboxBitmapAttribute オブジェクトに関連付けられているImage オブジェクト。

注釈

このメソッドは、namespace.classname.bmpという名前のリソースを検索します。名前空間は、 component パラメーターで指定されたオブジェクトの型の定義を含む名前空間です。 たとえば、ControlA 型のオブジェクトを component パラメーターに渡すとします。 ControlA が AssemblyA.dllの NamespaceA にある場合、このメソッドは NamespaceA.ControlA.bmpという名前のリソースを AssemblyA.dll 検索します。

この ToolboxBitmapAttribute オブジェクトにまだ大きなイメージがない場合、このメソッドは小さなイメージをスケーリングして大きなイメージを作成します。

適用対象

GetImage(Type, Boolean)

このToolboxBitmapAttribute オブジェクトに関連付けられている小さいImageまたは大きいを取得します。

public:
 System::Drawing::Image ^ GetImage(Type ^ type, bool large);
public System.Drawing.Image GetImage(Type type, bool large);
member this.GetImage : Type * bool -> System.Drawing.Image
Public Function GetImage (type As Type, large As Boolean) As Image

パラメーター

type
Type

この ToolboxBitmapAttribute オブジェクトに小さなイメージがない場合、このメソッドは、コンポーネントの種類で指定された型を定義するビットマップ リソースをアセンブリ内で検索します。 たとえば、typeof(ControlA) を型パラメーターに渡すと、このメソッドは ControlA を定義するアセンブリを検索します。

large
Boolean

このメソッドが大きなイメージ (true) または小さなイメージ (false) を返すかどうかを指定します。 小さい画像は 16 ~ 16 で、大きな画像は 32 ~ 32 です。

返品

このToolboxBitmapAttribute オブジェクトに関連付けられているImage

注釈

このメソッドは、namespace.classname.bmpという名前のリソースを検索します。名前空間は、 type パラメーターで指定された型の定義を含む名前空間です。 たとえば、typeof(ControlA) を type パラメーターに渡すとします。 ControlA が AssemblyA.dllの NamespaceA にある場合、このメソッドは NamespaceA.ControlA.bmpという名前のリソースを AssemblyA.dll 検索します。

この ToolboxBitmapAttribute オブジェクトにまだ大きなイメージがない場合、このメソッドは小さなイメージをスケーリングして大きなイメージを作成します。

適用対象

GetImage(Type, String, Boolean)

このToolboxBitmapAttribute オブジェクトに関連付けられている小さいImageまたは大きいを取得します。

public:
 System::Drawing::Image ^ GetImage(Type ^ type, System::String ^ imgName, bool large);
public System.Drawing.Image GetImage(Type type, string imgName, bool large);
member this.GetImage : Type * string * bool -> System.Drawing.Image
Public Function GetImage (type As Type, imgName As String, large As Boolean) As Image

パラメーター

type
Type

この ToolboxBitmapAttribute オブジェクトに小さなイメージがない場合、このメソッドは、コンポーネントの種類で指定された型を定義するアセンブリ内の埋め込みビットマップ リソースを検索します。 たとえば、typeof(ControlA) を型パラメーターに渡すと、このメソッドは ControlA を定義するアセンブリを検索します。

imgName
String

埋め込みビットマップ リソースの名前。

large
Boolean

このメソッドが大きなイメージ (true) または小さなイメージ (false) を返すかどうかを指定します。 小さい画像は 16 ~ 16 で、大きな画像は 32 ~ 32 です。

返品

このToolboxBitmapAttribute オブジェクトに関連付けられているImage

注釈

このメソッドは、namespace.imgName という名前のリソースを検索します。名前空間は、 type パラメーターで指定された型の定義を含む名前空間です。 たとえば、typeof(ControlA) を type パラメーターに渡し、imgName パラメーターに "MyBitmap.bmp" を渡したとします。 ControlA が AssemblyA.dllの NamespaceA にある場合、このメソッドは NamespaceA.MyBitmap.bmpという名前のリソースを AssemblyA.dll 検索します。

この ToolboxBitmapAttribute オブジェクトにまだ大きなイメージがない場合、このメソッドは小さなイメージをスケーリングして大きなイメージを作成します。

適用対象