ToolboxBitmapAttributeとは? わかりやすく解説

ToolboxBitmapAttribute クラス

Microsoft Visual Studio フォーム デザイナなど、コンテナ内のコントロールを表すアイコン指定できるようにします。

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

<AttributeUsageAttribute(AttributeTargets.Class)> _
Public Class ToolboxBitmapAttribute
    Inherits Attribute
Dim instance As ToolboxBitmapAttribute
[AttributeUsageAttribute(AttributeTargets.Class)] 
public class ToolboxBitmapAttribute : Attribute
[AttributeUsageAttribute(AttributeTargets::Class)] 
public ref class ToolboxBitmapAttribute : public
 Attribute
/** @attribute AttributeUsageAttribute(AttributeTargets.Class) */ 
public class ToolboxBitmapAttribute extends
 Attribute
AttributeUsageAttribute(AttributeTargets.Class) 
public class ToolboxBitmapAttribute extends
 Attribute
解説解説
使用例使用例

ToolboxBitmapAttribute クラス使用してstop.bmpStopSignControlツールボックス アイコンとして設定する方法次のコード例示します。この例では、c:\ に stop.bmp という名前の 16 × 16 ピクセルビットマップ存在することを前提にしています。

<System.Drawing.ToolboxBitmap("c:\stop.bmp")>
 _
Public Class StopSignControl
    Inherits System.Windows.Forms.UserControl

    Friend WithEvents Label1 As
 System.Windows.Forms.Label
    Friend WithEvents Button1 As
 System.Windows.Forms.Button

    Public Sub New()
        MyBase.New()
        Me.Label1 = New System.Windows.Forms.Label
        Me.Button1 = New System.Windows.Forms.Button

        Me.Label1.Font = New System.Drawing.Font("Microsoft
 Sans Serif", _
            12.0F, System.Drawing.FontStyle.Regular, _
            System.Drawing.GraphicsUnit.Point, CType(0, Byte))

        Me.Label1.ForeColor = System.Drawing.Color.Red
        Me.Label1.Location = New System.Drawing.Point(24,
 56)
        Me.Label1.Name = "Label1"
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "Stop!"
        Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter

        Me.Button1.Enabled = False
        Me.Button1.Location = New System.Drawing.Point(56,
 88)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(40,
 32)
        Me.Button1.TabIndex = 1
        Me.Button1.Text = "stop"

        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.Label1)
        Me.Name = "StopSignControl"

    End Sub

    Private Sub StopSignControl_MouseEnter(ByVal
 sender As Object, _
        ByVal e As System.EventArgs) Handles
 MyBase.MouseEnter

        Label1.Text.ToUpper()
        Label1.Font = New System.Drawing.Font(Label1.Font.FontFamily,
 _
            14.0F, System.Drawing.FontStyle.Bold)
        Button1.Enabled = True
    End Sub

    Private Sub StopSignControl_MouseLeave(ByVal
 sender As Object, _
        ByVal e As System.EventArgs) Handles
 MyBase.MouseLeave

        Label1.Text.ToLower()
        Label1.Font = New System.Drawing.Font(Label1.Font.FontFamily,
 12.0F, _
             System.Drawing.FontStyle.Regular)
        Button1.Enabled = False
    End Sub

End Class
[System.Drawing.ToolboxBitmap("c:\\stop.bmp")]
public class StopSignControl:
    System.Windows.Forms.UserControl

{
    internal System.Windows.Forms.Label Label1;
    internal System.Windows.Forms.Button Button1;

    public StopSignControl() : base()
    {        
        this.Label1 = new System.Windows.Forms.Label();
        this.Button1 = new System.Windows.Forms.Button();

        this.Label1.Font = new System.Drawing.Font("Microsoft
 Sans Serif", 12.0F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
 ((byte) 0));

        this.Label1.ForeColor = System.Drawing.Color.Red;
        this.Label1.Location = new System.Drawing.Point(24,
 56);
        this.Label1.Name = "Label1";
        this.Label1.TabIndex = 0;
        this.Label1.Text = "Stop!";
        this.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;

        this.Button1.Enabled = false;
        this.Button1.Location = new System.Drawing.Point(56,
 88);
        this.Button1.Name = "Button1";
        this.Button1.Size = new System.Drawing.Size(40,
 32);
        this.Button1.TabIndex = 1;
        this.Button1.Text = "stop";

        this.Controls.Add(this.Button1);
        this.Controls.Add(this.Label1);
        this.Name = "StopSignControl";

    }

    private void StopSignControl_MouseEnter(object
 sender, System.EventArgs e)
    {

        Label1.Text.ToUpper();
        Label1.Font = new System.Drawing.Font(Label1.Font.FontFamily,
 14.0F, 
        System.Drawing.FontStyle.Bold);
        Button1.Enabled = true;
    }

    private void StopSignControl_MouseLeave(object
 sender, System.EventArgs e)
    {

        Label1.Text.ToLower();
        Label1.Font = new System.Drawing.Font(Label1.Font.FontFamily,
 12.0F, 
        System.Drawing.FontStyle.Regular);
        Button1.Enabled = false;
    }

}
[ToolboxBitmap("c:\\stop.bmp")]
public ref class StopSignControl:
    public System::Windows::Forms::UserControl
{
private:
    Label^ label1;
private:
    Button^ button1;

public:
    StopSignControl() : UserControl()
    {
        this->label1 = gcnew System::Windows::Forms::Label();
        this->button1 = gcnew System::Windows::Forms::Button();

        this->label1->Font = gcnew System::Drawing::Font(
            "Microsoft Sans Serif", 12.0F,
            System::Drawing::FontStyle::Regular,
            System::Drawing::GraphicsUnit::Point, ((Byte) 0));

        this->label1->ForeColor = System::Drawing::Color::Red;
        this->label1->Location = System::Drawing::Point(24,
 56);
        this->label1->Name = "Label1";
        this->label1->TabIndex = 0;
        this->label1->Text = "Stop!";
        this->label1->TextAlign =
            System::Drawing::ContentAlignment::MiddleCenter;

        this->button1->Enabled = false;
        this->button1->Location = System::Drawing::Point(56,
 88);
        this->button1->Name = "Button1";
        this->button1->Size = System::Drawing::Size(40,
 32);
        this->button1->TabIndex = 1;
        this->button1->Text = "stop";

        this->Controls->Add(this->button1);
        this->Controls->Add(this->label1);
        this->Name = "StopSignControl";

        this->MouseEnter +=
            gcnew EventHandler(this, 
                &StopSignControl::StopSignControl_MouseEnter);
        this->MouseLeave +=
            gcnew EventHandler(this, 
                &StopSignControl::StopSignControl_MouseLeave);

    }

private:
    void StopSignControl_MouseEnter(Object^ sender,
        EventArgs^ e)
    {

        label1->Text = label1->Text->ToUpper();
        label1->Font = gcnew System::Drawing::Font(label1->Font->FontFamily
,
            14.0F, FontStyle::Bold);
        button1->Enabled = true;
    }

private:
    void StopSignControl_MouseLeave(Object^ sender,
        EventArgs^ e)
    {

        label1->Text = label1->Text->ToLower();
        label1->Font = gcnew System::Drawing::Font(label1->Font->FontFamily
,
            12.0F, FontStyle::Regular);
        button1->Enabled = false;
    }

};
/** @attribute System.Drawing.ToolboxBitmap("c:\\stop.bmp")
 */
public class StopSignControl extends System.Windows.Forms.UserControl
{
    System.Windows.Forms.Label label1;
    System.Windows.Forms.Button button1;

    public StopSignControl()
    {
        this.label1 = new System.Windows.Forms.Label();
        this.button1 = new System.Windows.Forms.Button();

        this.label1.set_Font(new System.Drawing.Font("Microsoft
 Sans Serif", 
            12, System.Drawing.FontStyle.Regular, 
            System.Drawing.GraphicsUnit.Point, (ubyte)0));

        this.label1.set_ForeColor(System.Drawing.Color.get_Red());
        this.label1.set_Location(new System.Drawing.Point(24,
 56));
        this.label1.set_Name("label1");
        this.label1.set_TabIndex(0);
        this.label1.set_Text("Stop!");
        this.label1.set_TextAlign(System.Drawing.ContentAlignment.MiddleCenter);

        this.button1.set_Enabled(false);
        this.button1.set_Location(new System.Drawing.Point(56,
 88));
        this.button1.set_Name("button1");
        this.button1.set_Size(new System.Drawing.Size(40,
 32));
        this.button1.set_TabIndex(1);
        this.button1.set_Text("stop");

        this.get_Controls().Add(this.button1);
        this.get_Controls().Add(this.label1);
        this.set_Name("StopSignControl");
    } //StopSignControl

    private void StopSignControl_MouseEnter(Object
 sender, System.EventArgs e)
    {
        label1.set_Text(label1.get_Text().ToUpper());
        label1.set_Font(new Font(label1.get_Font().get_FontFamily(),
 14, 
            FontStyle.Bold));
        button1.set_Enabled(true);
    } //StopSignControl_MouseEnter

    private void StopSignControl_MouseLeave(Object
 sender, System.EventArgs e)
    {
        label1.set_Text(label1.get_Text().ToLower());
        label1.set_Font(new Font(label1.get_Font().get_FontFamily(),
 12, 
            System.Drawing.FontStyle.Regular));
        button1.set_Enabled(false);
    } //StopSignControl_MouseLeave
} //StopSignControl
継承階層継承階層
System.Object
   System.Attribute
    System.Drawing.ToolboxBitmapAttribute
スレッド セーフスレッド セーフ
この型の public static (Visual Basic では Shared) メンバはすべて、スレッド セーフです。インスタンス メンバ場合は、スレッド セーフであるとは限りません。
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照

ToolboxBitmapAttribute コンストラクタ (String)

指定したファイルイメージ使用して新しい ToolboxBitmapAttribute オブジェクト初期化します。

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

public ToolboxBitmapAttribute (
    string imageFile
)
public:
ToolboxBitmapAttribute (
    String^ imageFile
)
public ToolboxBitmapAttribute (
    String imageFile
)
public function ToolboxBitmapAttribute (
    imageFile : String
)

パラメータ

imageFile

16 x 16ビットマップ格納しているファイルの名前。

使用例使用例

ToolboxBitmapAttribute コンストラクタ使用してstop.bmpStopSignControlツールボックス アイコンとして設定する方法次のコード例示します。この例では、c:\ に stop.bmp という名前の 16 × 16 ピクセルビットマップ存在することを前提にしています。

<System.Drawing.ToolboxBitmap("c:\stop.bmp")>
 _
Public Class StopSignControl
    Inherits System.Windows.Forms.UserControl

    Friend WithEvents Label1 As
 System.Windows.Forms.Label
    Friend WithEvents Button1 As
 System.Windows.Forms.Button

    Public Sub New()
        MyBase.New()
        Me.Label1 = New System.Windows.Forms.Label
        Me.Button1 = New System.Windows.Forms.Button

        Me.Label1.Font = New System.Drawing.Font("Microsoft
 Sans Serif", _
            12.0F, System.Drawing.FontStyle.Regular, _
            System.Drawing.GraphicsUnit.Point, CType(0, Byte))

        Me.Label1.ForeColor = System.Drawing.Color.Red
        Me.Label1.Location = New System.Drawing.Point(24,
 56)
        Me.Label1.Name = "Label1"
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "Stop!"
        Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter

        Me.Button1.Enabled = False
        Me.Button1.Location = New System.Drawing.Point(56,
 88)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(40,
 32)
        Me.Button1.TabIndex = 1
        Me.Button1.Text = "stop"

        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.Label1)
        Me.Name = "StopSignControl"

    End Sub

    Private Sub StopSignControl_MouseEnter(ByVal
 sender As Object, _
        ByVal e As System.EventArgs) Handles
 MyBase.MouseEnter

        Label1.Text.ToUpper()
        Label1.Font = New System.Drawing.Font(Label1.Font.FontFamily,
 _
            14.0F, System.Drawing.FontStyle.Bold)
        Button1.Enabled = True
    End Sub

    Private Sub StopSignControl_MouseLeave(ByVal
 sender As Object, _
        ByVal e As System.EventArgs) Handles
 MyBase.MouseLeave

        Label1.Text.ToLower()
        Label1.Font = New System.Drawing.Font(Label1.Font.FontFamily,
 12.0F, _
             System.Drawing.FontStyle.Regular)
        Button1.Enabled = False
    End Sub

End Class
[System.Drawing.ToolboxBitmap("c:\\stop.bmp")]
public class StopSignControl:
    System.Windows.Forms.UserControl

{
    internal System.Windows.Forms.Label Label1;
    internal System.Windows.Forms.Button Button1;

    public StopSignControl() : base()
    {        
        this.Label1 = new System.Windows.Forms.Label();
        this.Button1 = new System.Windows.Forms.Button();

        this.Label1.Font = new System.Drawing.Font("Microsoft
 Sans Serif", 12.0F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point,
 ((byte) 0));

        this.Label1.ForeColor = System.Drawing.Color.Red;
        this.Label1.Location = new System.Drawing.Point(24,
 56);
        this.Label1.Name = "Label1";
        this.Label1.TabIndex = 0;
        this.Label1.Text = "Stop!";
        this.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;

        this.Button1.Enabled = false;
        this.Button1.Location = new System.Drawing.Point(56,
 88);
        this.Button1.Name = "Button1";
        this.Button1.Size = new System.Drawing.Size(40,
 32);
        this.Button1.TabIndex = 1;
        this.Button1.Text = "stop";

        this.Controls.Add(this.Button1);
        this.Controls.Add(this.Label1);
        this.Name = "StopSignControl";

    }

    private void StopSignControl_MouseEnter(object
 sender, System.EventArgs e)
    {

        Label1.Text.ToUpper();
        Label1.Font = new System.Drawing.Font(Label1.Font.FontFamily,
 14.0F, 
        System.Drawing.FontStyle.Bold);
        Button1.Enabled = true;
    }

    private void StopSignControl_MouseLeave(object
 sender, System.EventArgs e)
    {

        Label1.Text.ToLower();
        Label1.Font = new System.Drawing.Font(Label1.Font.FontFamily,
 12.0F, 
        System.Drawing.FontStyle.Regular);
        Button1.Enabled = false;
    }

}
[ToolboxBitmap("c:\\stop.bmp")]
public ref class StopSignControl:
    public System::Windows::Forms::UserControl
{
private:
    Label^ label1;
private:
    Button^ button1;

public:
    StopSignControl() : UserControl()
    {
        this->label1 = gcnew System::Windows::Forms::Label();
        this->button1 = gcnew System::Windows::Forms::Button();

        this->label1->Font = gcnew System::Drawing::Font(
            "Microsoft Sans Serif", 12.0F,
            System::Drawing::FontStyle::Regular,
            System::Drawing::GraphicsUnit::Point, ((Byte) 0));

        this->label1->ForeColor = System::Drawing::Color::Red;
        this->label1->Location = System::Drawing::Point(24,
 56);
        this->label1->Name = "Label1";
        this->label1->TabIndex = 0;
        this->label1->Text = "Stop!";
        this->label1->TextAlign =
            System::Drawing::ContentAlignment::MiddleCenter;

        this->button1->Enabled = false;
        this->button1->Location = System::Drawing::Point(56,
 88);
        this->button1->Name = "Button1";
        this->button1->Size = System::Drawing::Size(40,
 32);
        this->button1->TabIndex = 1;
        this->button1->Text = "stop";

        this->Controls->Add(this->button1);
        this->Controls->Add(this->label1);
        this->Name = "StopSignControl";

        this->MouseEnter +=
            gcnew EventHandler(this, 
                &StopSignControl::StopSignControl_MouseEnter);
        this->MouseLeave +=
            gcnew EventHandler(this, 
                &StopSignControl::StopSignControl_MouseLeave);

    }

private:
    void StopSignControl_MouseEnter(Object^ sender,
        EventArgs^ e)
    {

        label1->Text = label1->Text->ToUpper();
        label1->Font = gcnew System::Drawing::Font(label1->Font->FontFamily
,
            14.0F, FontStyle::Bold);
        button1->Enabled = true;
    }

private:
    void StopSignControl_MouseLeave(Object^ sender,
        EventArgs^ e)
    {

        label1->Text = label1->Text->ToLower();
        label1->Font = gcnew System::Drawing::Font(label1->Font->FontFamily
,
            12.0F, FontStyle::Regular);
        button1->Enabled = false;
    }

};
/** @attribute System.Drawing.ToolboxBitmap("c:\\stop.bmp")
 */
public class StopSignControl extends System.Windows.Forms.UserControl
{
    System.Windows.Forms.Label label1;
    System.Windows.Forms.Button button1;

    public StopSignControl()
    {
        this.label1 = new System.Windows.Forms.Label();
        this.button1 = new System.Windows.Forms.Button();

        this.label1.set_Font(new System.Drawing.Font("Microsoft
 Sans Serif", 
            12, System.Drawing.FontStyle.Regular, 
            System.Drawing.GraphicsUnit.Point, (ubyte)0));

        this.label1.set_ForeColor(System.Drawing.Color.get_Red());
        this.label1.set_Location(new System.Drawing.Point(24,
 56));
        this.label1.set_Name("label1");
        this.label1.set_TabIndex(0);
        this.label1.set_Text("Stop!");
        this.label1.set_TextAlign(System.Drawing.ContentAlignment.MiddleCenter);

        this.button1.set_Enabled(false);
        this.button1.set_Location(new System.Drawing.Point(56,
 88));
        this.button1.set_Name("button1");
        this.button1.set_Size(new System.Drawing.Size(40,
 32));
        this.button1.set_TabIndex(1);
        this.button1.set_Text("stop");

        this.get_Controls().Add(this.button1);
        this.get_Controls().Add(this.label1);
        this.set_Name("StopSignControl");
    } //StopSignControl

    private void StopSignControl_MouseEnter(Object
 sender, System.EventArgs e)
    {
        label1.set_Text(label1.get_Text().ToUpper());
        label1.set_Font(new Font(label1.get_Font().get_FontFamily(),
 14, 
            FontStyle.Bold));
        button1.set_Enabled(true);
    } //StopSignControl_MouseEnter

    private void StopSignControl_MouseLeave(Object
 sender, System.EventArgs e)
    {
        label1.set_Text(label1.get_Text().ToLower());
        label1.set_Font(new Font(label1.get_Font().get_FontFamily(),
 12, 
            System.Drawing.FontStyle.Regular));
        button1.set_Enabled(false);
    } //StopSignControl_MouseLeave
} //StopSignControl
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ToolboxBitmapAttribute クラス
ToolboxBitmapAttribute メンバ
System.Drawing 名前空間

ToolboxBitmapAttribute コンストラクタ (Type, String)

指定したアセンブリリソースとして埋め込まれている 16 x 16ビットマップ基づいて新しい ToolboxBitmapAttribute オブジェクト初期化します。

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Dim t As Type
Dim name As String

Dim instance As New ToolboxBitmapAttribute(t,
 name)
public ToolboxBitmapAttribute (
    Type t,
    string name
)
public:
ToolboxBitmapAttribute (
    Type^ t, 
    String^ name
)
public ToolboxBitmapAttribute (
    Type t, 
    String name
)
public function ToolboxBitmapAttribute (
    t : Type, 
    name : String
)

パラメータ

t

ビットマップ リソース検索対象となるアセンブリ定義する Type

name

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

解説解説

このコンストラクタは、t パラメータ指定された型を定義するアセンブリで、埋め込みリソース検索します。このコンストラクタは、namespace.name (namespacet パラメータ指定されクラスの定義を含む名前空間) という名前のリソース検索します。たとえば、ControlA が AssemblyA.dll 内の NamespaceA に存在するクラスで、"MyBitmap.bmp" を name パラメータ渡した場合想定します。この場合、このコンストラクタは、AssemblyA.dll で NamespaceA.MyBitmap.bmp というリソース検索します

使用例使用例

ToolboxBitmapAttribute コンストラクタ使用してStopSignControl2.bmpStopSignControl2ツールボックス アイコンとして設定する方法次のコード例示します。この例では、BuildAction プロパティEmbeddedResource設定したStopSignControl2.bmp という名前の 16 × 16 ピクセルビットマップ存在することを前提にしています。

<System.Drawing.ToolboxBitmap(GetType(StopSignControl2), "StopSignControl2.bmp")>
 _
Public Class StopSignControl2
    Inherits System.Windows.Forms.UserControl

    Friend WithEvents Label1 As
 System.Windows.Forms.Label
    Friend WithEvents Button1 As
 System.Windows.Forms.Button

    Public Sub New()
        MyBase.New()
        Me.Label1 = New System.Windows.Forms.Label
        Me.Button1 = New System.Windows.Forms.Button

        Me.Label1.Font = New System.Drawing.Font("Microsoft
 Sans Serif", _
            12.0F, System.Drawing.FontStyle.Regular, _
            System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label1.ForeColor = System.Drawing.Color.Red
        Me.Label1.Location = New System.Drawing.Point(24,
 56)
        Me.Label1.Name = "Label1"
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "Stop!"
        Me.Label1.TextAlign = _
            System.Drawing.ContentAlignment.MiddleCenter
        Me.Button1.Enabled = False
        Me.Button1.Location = New System.Drawing.Point(56,
 88)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(40,
 32)
        Me.Button1.TabIndex = 1
        Me.Button1.Text = "stop"
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.Label1)
        Me.Name = "StopSignControl"

    End Sub

    Private Sub StopSignControl_MouseEnter(ByVal
 sender As Object, _
        ByVal e As System.EventArgs) Handles
 MyBase.MouseEnter
        Label1.Text.ToUpper()
        Label1.Font = New System.Drawing.Font(Label1.Font.FontFamily,
 14.0F, _
             System.Drawing.FontStyle.Bold)
        Button1.Enabled = True
    End Sub

    Private Sub StopSignControl_MouseLeave(ByVal
 sender As Object, _
        ByVal e As System.EventArgs) Handles
 MyBase.MouseLeave

        Label1.Text.ToLower()
        Label1.Font = New System.Drawing.Font(Label1.Font.FontFamily,
 12.0F, _
             System.Drawing.FontStyle.Regular)
        Button1.Enabled = False
    End Sub

End Class
[System.Drawing.ToolboxBitmap(typeof(StopSignControl2), "StopSignControl2.bmp")]
public class StopSignControl2:
    System.Windows.Forms.UserControl

{
    internal System.Windows.Forms.Label Label1;
    internal System.Windows.Forms.Button Button1;

    public StopSignControl2() : base()
    {        
        this.Label1 = new System.Windows.Forms.Label();
        this.Button1 = new System.Windows.Forms.Button();

        this.Label1.Font = new System.Drawing.Font("Microsoft
 Sans Serif", 
            12.0F, System.Drawing.FontStyle.Regular, 
            System.Drawing.GraphicsUnit.Point, ((byte) 0));
        this.Label1.ForeColor = System.Drawing.Color.Red;
        this.Label1.Location = new System.Drawing.Point(24,
 56);
        this.Label1.Name = "Label1";
        this.Label1.TabIndex = 0;
        this.Label1.Text = "Stop!";
        this.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
        this.Button1.Enabled = false;
        this.Button1.Location = new System.Drawing.Point(56,
 88);
        this.Button1.Name = "Button1";
        this.Button1.Size = new System.Drawing.Size(40,
 32);
        this.Button1.TabIndex = 1;
        this.Button1.Text = "stop";
        this.Controls.Add(this.Button1);
        this.Controls.Add(this.Label1);
        this.Name = "StopSignControl";

    }

    private void StopSignControl_MouseEnter(object
 sender, System.EventArgs e)
    {
        Label1.Text.ToUpper();
        Label1.Font = new System.Drawing.Font(Label1.Font.FontFamily,
 14.0F, 
            System.Drawing.FontStyle.Bold);
        Button1.Enabled = true;
    }

    private void StopSignControl_MouseLeave(object
 sender, System.EventArgs e)
    {

        Label1.Text.ToLower();
        Label1.Font = new System.Drawing.Font(Label1.Font.FontFamily,
 12.0F, 
        System.Drawing.FontStyle.Regular);
        Button1.Enabled = false;
    }

}
[ToolboxBitmap(StopSignControl2::typeid, "StopSignControl2.bmp")]
public ref class StopSignControl2:
    public System::Windows::Forms::UserControl
{
private:
    Label^ label1;
private:
    Button^ button1;

public:
    StopSignControl2() : UserControl()
    {
        this->label1 = gcnew System::Windows::Forms::Label();
        this->button1 = gcnew System::Windows::Forms::Button();

        this->label1->Font = gcnew System::Drawing::Font(
            "Microsoft Sans Serif", 12.0F,
            System::Drawing::FontStyle::Regular,
            System::Drawing::GraphicsUnit::Point, ((Byte) 0));
        this->label1->ForeColor = System::Drawing::Color::Red;
        this->label1->Location = System::Drawing::Point(24,
 56);
        this->label1->Name = "Label1";
        this->label1->TabIndex = 0;
        this->label1->Text = "Stop!";
        this->label1->TextAlign =
            System::Drawing::ContentAlignment::MiddleCenter;
        this->button1->Enabled = false;
        this->button1->Location = System::Drawing::Point(56,
 88);
        this->button1->Name = "Button1";
        this->button1->Size = System::Drawing::Size(40,
 32);
        this->button1->TabIndex = 1;
        this->button1->Text = "stop";
        this->Controls->Add(this->button1);
        this->Controls->Add(this->label1);
        this->Name = "StopSignControl";

        this->MouseEnter += gcnew EventHandler(this,
 
            &StopSignControl2::StopSignControl_MouseEnter);
        this->MouseLeave += gcnew EventHandler(this,
 
            &StopSignControl2::StopSignControl_MouseLeave);

    }

private:
    void StopSignControl_MouseEnter(Object^ sender, EventArgs^
 e)
    {
        label1->Text = label1->Text->ToUpper();
        label1->Font = gcnew System::Drawing::Font(label1->Font->FontFamily
,
            14.0F, FontStyle::Bold);
        button1->Enabled = true;
    }

private:
    void StopSignControl_MouseLeave(Object^ sender, EventArgs^
 e)
    {

        label1->Text = label1->Text->ToLower();
        label1->Font = gcnew System::Drawing::Font(label1->Font->FontFamily
,
            12.0F, FontStyle::Regular);
        button1->Enabled = false;
    }

};
/** @attribute System.Drawing.ToolboxBitmap(StopSignControl2.class,
 "StopSignControl2.bmp")
 */
public class StopSignControl2 extends System.Windows.Forms.UserControl
{
    System.Windows.Forms.Label label1;
    System.Windows.Forms.Button button1;

    public StopSignControl2()
    {
        this.label1 = new System.Windows.Forms.Label();
        this.button1 = new System.Windows.Forms.Button();
        this.label1.set_Font(new System.Drawing.Font("Microsoft
 Sans Serif", 12,
            System.Drawing.FontStyle.Regular, 
            System.Drawing.GraphicsUnit.Point, (ubyte)0));
        this.label1.set_ForeColor(System.Drawing.Color.get_Red());
        this.label1.set_Location(new System.Drawing.Point(24,
 56));
        this.label1.set_Name("label1");
        this.label1.set_TabIndex(0);
        this.label1.set_Text("Stop!");
        this.label1.set_TextAlign(System.Drawing.ContentAlignment.MiddleCenter);
        this.button1.set_Enabled(false);
        this.button1.set_Location(new System.Drawing.Point(56,
 88));
        this.button1.set_Name("button1");
        this.button1.set_Size(new System.Drawing.Size(40,
 32));
        this.button1.set_TabIndex(1);
        this.button1.set_Text("stop");
        this.get_Controls().Add(this.button1);
        this.get_Controls().Add(this.label1);
        this.set_Name("StopSignControl");
    } //StopSignControl2

    private void StopSignControl_MouseEnter(Object
 sender, System.EventArgs e)
    {
        label1.set_Text(label1.get_Text().ToUpper());
        label1.set_Font(new Font(label1.get_Font().get_FontFamily(),
 14, 
            FontStyle.Bold));
        button1.set_Enabled(true);
    } //StopSignControl_MouseEnter

    private void StopSignControl_MouseLeave(Object
 sender, System.EventArgs e)
    {
        label1.set_Text(label1.get_Text().ToLower());
        label1.set_Font(new Font(label1.get_Font().get_FontFamily(),
 12, 
            System.Drawing.FontStyle.Regular));
        button1.set_Enabled(false);
    } //StopSignControl_MouseLeave
} //StopSignControl2
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ToolboxBitmapAttribute クラス
ToolboxBitmapAttribute メンバ
System.Drawing 名前空間

ToolboxBitmapAttribute コンストラクタ


オーバーロードの一覧オーバーロードの一覧

名前 説明
ToolboxBitmapAttribute (String) 指定したファイルイメージ使用して新しい ToolboxBitmapAttribute オブジェクト初期化します。
ToolboxBitmapAttribute (Type) 指定したアセンブリリソースとして埋め込まれている 16 x 16ビットマップ基づいて新しToolboxBitmapAttribute オブジェクト初期化します。
ToolboxBitmapAttribute (Type, String) 指定したアセンブリリソースとして埋め込まれている 16 x 16ビットマップ基づいて新しToolboxBitmapAttribute オブジェクト初期化します。
参照参照

関連項目

ToolboxBitmapAttribute クラス
ToolboxBitmapAttribute メンバ
System.Drawing 名前空間

ToolboxBitmapAttribute コンストラクタ (Type)

指定したアセンブリリソースとして埋め込まれている 16 x 16ビットマップ基づいて新しい ToolboxBitmapAttribute オブジェクト初期化します。

名前空間: System.Drawing
アセンブリ: System.Drawing (system.drawing.dll 内)
構文構文

Dim t As Type

Dim instance As New ToolboxBitmapAttribute(t)
public ToolboxBitmapAttribute (
    Type t
)
public:
ToolboxBitmapAttribute (
    Type^ t
)
public ToolboxBitmapAttribute (
    Type t
)
public function ToolboxBitmapAttribute (
    t : Type
)

パラメータ

t

ビットマップ リソース検索対象となるアセンブリ定義する Type

解説解説

このコンストラクタは、t パラメータ指定された型を定義するアセンブリで、埋め込みリソース検索します。このコンストラクタは、namespace.classname.bmp (namespacet パラメータ指定されクラスの定義を含む名前空間) という名前のリソース検索します。たとえば、ControlA が AssemblyA.dll の NamespaceA に含まれる場合、このコンストラクタは、AssemblyA.dll で NamespaceA.ControlA.bmp という名前のリソース検索します

使用例使用例

ToolboxBitmapAttribute コンストラクタ使用してボタン コントロールアイコンStopSignControl3 という名前の UserControlツールボックス アイコン設定する方法次のコード例示します

<System.Drawing.ToolboxBitmap(GetType(System.Windows.Forms.Button))>
 _
Public Class StopSignControl3
    Inherits System.Windows.Forms.UserControl

    Friend WithEvents Label1 As
 System.Windows.Forms.Label
    Friend WithEvents Button1 As
 System.Windows.Forms.Button

    Public Sub New()
        MyBase.New()
        Me.Label1 = New System.Windows.Forms.Label
        Me.Button1 = New System.Windows.Forms.Button

        Me.Label1.Font = New System.Drawing.Font("Microsoft
 Sans Serif", _
            12.0F, System.Drawing.FontStyle.Regular, _
            System.Drawing.GraphicsUnit.Point, CType(0, Byte))
        Me.Label1.ForeColor = System.Drawing.Color.Red
        Me.Label1.Location = New System.Drawing.Point(24,
 56)
        Me.Label1.Name = "Label1"
        Me.Label1.TabIndex = 0
        Me.Label1.Text = "Stop!"
        Me.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter

        Me.Button1.Enabled = False
        Me.Button1.Location = New System.Drawing.Point(56,
 88)
        Me.Button1.Name = "Button1"
        Me.Button1.Size = New System.Drawing.Size(40,
 32)
        Me.Button1.TabIndex = 1
        Me.Button1.Text = "stop"
        Me.Controls.Add(Me.Button1)
        Me.Controls.Add(Me.Label1)
        Me.Name = "StopSignControl"

    End Sub

    Private Sub StopSignControl_MouseEnter(ByVal
 sender As Object, _
        ByVal e As System.EventArgs) Handles
 MyBase.MouseEnter
        Label1.Text.ToUpper()
        Label1.Font = New System.Drawing.Font(Label1.Font.FontFamily,
 14.0F, _
            System.Drawing.FontStyle.Bold)
        Button1.Enabled = True
    End Sub

    Private Sub StopSignControl_MouseLeave(ByVal
 sender As Object, _
        ByVal e As System.EventArgs) Handles
 MyBase.MouseLeave
        Label1.Text.ToLower()
        Label1.Font = New System.Drawing.Font(Label1.Font.FontFamily,
 12.0F, _
             System.Drawing.FontStyle.Regular)
        Button1.Enabled = False
    End Sub

End Class
[System.Drawing.ToolboxBitmap(typeof(System.Windows.Forms.Button))]
public class StopSignControl3:
    System.Windows.Forms.UserControl

{
    internal System.Windows.Forms.Label Label1;
    internal System.Windows.Forms.Button Button1;

    public StopSignControl3() : base()
    {        
        this.Label1 = new System.Windows.Forms.Label();
        this.Button1 = new System.Windows.Forms.Button();

        this.Label1.Font = new System.Drawing.Font("Microsoft
 Sans Serif", 
            12.0F, System.Drawing.FontStyle.Regular, 
            System.Drawing.GraphicsUnit.Point, ((byte) 0));
        this.Label1.ForeColor = System.Drawing.Color.Red;
        this.Label1.Location = new System.Drawing.Point(24,
 56);
        this.Label1.Name = "Label1";
        this.Label1.TabIndex = 0;
        this.Label1.Text = "Stop!";
        this.Label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;

        this.Button1.Enabled = false;
        this.Button1.Location = new System.Drawing.Point(56,
 88);
        this.Button1.Name = "Button1";
        this.Button1.Size = new System.Drawing.Size(40,
 32);
        this.Button1.TabIndex = 1;
        this.Button1.Text = "stop";
        this.Controls.Add(this.Button1);
        this.Controls.Add(this.Label1);
        this.Name = "StopSignControl";

    }

    private void StopSignControl_MouseEnter(object
 sender, System.EventArgs e)
    {
        Label1.Text.ToUpper();
        Label1.Font = new System.Drawing.Font(Label1.Font.FontFamily
,
        14.0F, System.Drawing.FontStyle.Bold);
        Button1.Enabled = true;
    }

    private void StopSignControl_MouseLeave(object
 sender, System.EventArgs e)
    {
        Label1.Text.ToLower();
        Label1.Font = new System.Drawing.Font(Label1.Font.FontFamily
, 
        12.0F, System.Drawing.FontStyle.Regular);
        Button1.Enabled = false;
    }

}
[ToolboxBitmap(Button::typeid)]
public ref class StopSignControl3:
    public System::Windows::Forms::UserControl
{
private:
    Label^ label1;
private:
    Button^ button1;

public:
    StopSignControl3() : UserControl()
    {
        this->label1 = gcnew System::Windows::Forms::Label();
        this->button1 = gcnew System::Windows::Forms::Button();

        this->label1->Font = gcnew System::Drawing::Font(
            "Microsoft Sans Serif", 12.0F,
            System::Drawing::FontStyle::Regular,
            System::Drawing::GraphicsUnit::Point,
            ((Byte) 0));
        this->label1->ForeColor = System::Drawing::Color::Red;
        this->label1->Location = System::Drawing::Point(24,
 56);
        this->label1->Name = "Label1";
        this->label1->TabIndex = 0;
        this->label1->Text = "Stop!";
        this->label1->TextAlign =
            System::Drawing::ContentAlignment::MiddleCenter;

        this->button1->Enabled = false;
        this->button1->Location = System::Drawing::Point(56,
 88);
        this->button1->Name = "Button1";
        this->button1->Size = System::Drawing::Size(40,
 32);
        this->button1->TabIndex = 1;
        this->button1->Text = "stop";
        this->Controls->Add(this->button1);
        this->Controls->Add(this->label1);
        this->Name = "StopSignControl";

        this->MouseEnter += gcnew EventHandler(this,
 
            &StopSignControl3::StopSignControl_MouseEnter);
        this->MouseLeave += gcnew EventHandler(this,
 
            &StopSignControl3::StopSignControl_MouseLeave);
    }

private:
    void StopSignControl_MouseEnter(Object^ sender, EventArgs^
 e)
    {
        label1->Text = label1->Text->ToUpper();
        label1->Font = gcnew System::Drawing::Font(label1->Font->FontFamily
,
            14.0F, FontStyle::Bold);
        button1->Enabled = true;
    }

private:
    void StopSignControl_MouseLeave(Object^ sender, EventArgs^
 e)
    {
        label1->Text = label1->Text->ToLower();
        label1->Font = gcnew System::Drawing::Font(label1->Font->FontFamily
,
            12.0F, FontStyle::Regular);
        button1->Enabled = false;
    }
};
/** @attribute System.Drawing.ToolboxBitmap(Button.class)
 */
public class StopSignControl3 extends System.Windows.Forms.UserControl
{
    System.Windows.Forms.Label label1;
    System.Windows.Forms.Button button1;

    public StopSignControl3()
    {
        this.label1 = new System.Windows.Forms.Label();
        this.button1 = new System.Windows.Forms.Button();

        this.label1.set_Font(new System.Drawing.Font("Microsoft
 Sans Serif", 
            12, System.Drawing.FontStyle.Regular, 
            System.Drawing.GraphicsUnit.Point, (ubyte)(0)));
        this.label1.set_ForeColor(System.Drawing.Color.get_Red());
        this.label1.set_Location(new System.Drawing.Point(24,
 56));
        this.label1.set_Name("label1");
        this.label1.set_TabIndex(0);
        this.label1.set_Text("Stop!");
        this.label1.set_TextAlign(System.Drawing.ContentAlignment.MiddleCenter);

        this.button1.set_Enabled(false);
        this.button1.set_Location(new System.Drawing.Point(56,
 88));
        this.button1.set_Name("button1");
        this.button1.set_Size(new System.Drawing.Size(40,
 32));
        this.button1.set_TabIndex(1);
        this.button1.set_Text("stop");
        this.get_Controls().Add(this.button1);
        this.get_Controls().Add(this.label1);
        this.set_Name("StopSignControl");
    } //StopSignControl3

    private void StopSignControl_MouseEnter(Object
 sender, System.EventArgs e)
    {
        label1.set_Text(label1.get_Text().ToUpper());
        label1.set_Font(new Font(label1.get_Font().get_FontFamily(),
 14, 
            FontStyle.Bold));
        button1.set_Enabled(true);
    } //StopSignControl_MouseEnter

    private void StopSignControl_MouseLeave(Object
 sender, System.EventArgs e)
    {
        label1.set_Text(label1.get_Text().ToUpper());
        label1.set_Font(new Font(label1.get_Font().get_FontFamily(),
 12, 
            System.Drawing.FontStyle.Regular));
        button1.set_Enabled(false);
    } //StopSignControl_MouseLeave
} //StopSignControl3 
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
ToolboxBitmapAttribute クラス
ToolboxBitmapAttribute メンバ
System.Drawing 名前空間

ToolboxBitmapAttribute フィールド


パブリック フィールドパブリック フィールド

  名前 説明
パブリック フィールド Default 小さイメージ大きイメージnull 参照 (Visual Basic では Nothing) に設定した ToolboxBitmapAttribute オブジェクト
参照参照

関連項目

ToolboxBitmapAttribute クラス
System.Drawing 名前空間

ToolboxBitmapAttribute プロパティ


パブリック プロパティパブリック プロパティ

  名前 説明
パブリック プロパティ TypeId  派生クラス実装されている場合は、この Attribute一意識別子取得します。 ( Attribute から継承されます。)
参照参照

関連項目

ToolboxBitmapAttribute クラス
System.Drawing 名前空間

ToolboxBitmapAttribute メソッド


パブリック メソッドパブリック メソッド

( プロテクト メソッド参照)
  名前 説明
パブリック メソッド Equals オーバーロードされますオーバーライドされます。  
パブリック メソッド GetCustomAttribute  オーバーロードされますアセンブリモジュール、型のメンバ、またはメソッド パラメータ適用され指定した型のカスタム属性取得します。 ( Attribute から継承されます。)
パブリック メソッド GetCustomAttributes  オーバーロードされますアセンブリモジュール、型のメンバ、またはメソッド パラメータ適用されカスタム属性配列取得します。 ( Attribute から継承されます。)
パブリック メソッド GetHashCode オーバーライドされます。 この ToolboxBitmapAttribute オブジェクトハッシュ コード取得します
パブリック メソッド GetImage オーバーロードされます。 この ToolboxBitmapAttribute オブジェクト関連付けられている、大きいまたは小さImage取得します
パブリック メソッド GetImageFromResource アセンブリ埋め込まれているビットマップ リソースから Image オブジェクト取り出して返します
パブリック メソッド GetType  現在のインスタンスType取得します。 ( Object から継承されます。)
パブリック メソッド IsDefaultAttribute  派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラス既定値かどうか示します。 ( Attribute から継承されます。)
パブリック メソッド IsDefined  オーバーロードされます指定した型のカスタム属性が、アセンブリモジュール、型のメンバ、またはメソッド パラメータ適用されているかどうか判断します。 ( Attribute から継承されます。)
パブリック メソッド Match  派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンス等しかどうかを示す値を返します。 ( Attribute から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 ( Object から継承されます。)
パブリック メソッド ToString  現在の Object を表す String返します。 ( Object から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

ToolboxBitmapAttribute クラス
System.Drawing 名前空間

ToolboxBitmapAttribute メンバ

Microsoft Visual Studio フォーム デザイナなど、コンテナ内のコントロールを表すアイコン指定できるようにします。

ToolboxBitmapAttribute データ型公開されるメンバを以下の表に示します


パブリック コンストラクタパブリック コンストラクタ
  名前 説明
パブリック メソッド ToolboxBitmapAttribute オーバーロードされます。  
パブリック フィールドパブリック フィールド
  名前 説明
パブリック フィールド Default 小さイメージ大きイメージnull 参照 (Visual Basic では Nothing) に設定した ToolboxBitmapAttribute オブジェクト
パブリック プロパティパブリック プロパティ
  名前 説明
パブリック プロパティ TypeId  派生クラス実装されている場合は、この Attribute一意識別子取得します。(Attribute から継承されます。)
パブリック メソッドパブリック メソッド
( プロテクト メソッド参照)
  名前 説明
パブリック メソッド Equals オーバーロードされますオーバーライドされます。  
パブリック メソッド GetCustomAttribute  オーバーロードされますアセンブリモジュール、型のメンバ、またはメソッド パラメータ適用され指定した型のカスタム属性取得します。 (Attribute から継承されます。)
パブリック メソッド GetCustomAttributes  オーバーロードされますアセンブリモジュール、型のメンバ、またはメソッド パラメータ適用されカスタム属性配列取得します。 (Attribute から継承されます。)
パブリック メソッド GetHashCode オーバーライドされます。 この ToolboxBitmapAttribute オブジェクトハッシュ コード取得します
パブリック メソッド GetImage オーバーロードされます。 この ToolboxBitmapAttribute オブジェクト関連付けられている、大きいまたは小さImage取得します
パブリック メソッド GetImageFromResource アセンブリ埋め込まれているビットマップ リソースから Image オブジェクト取り出して返します
パブリック メソッド GetType  現在のインスタンスType取得します。 (Object から継承されます。)
パブリック メソッド IsDefaultAttribute  派生クラス内でオーバーライドされたときに、このインスタンスの値が派生クラス既定値かどうか示します。 (Attribute から継承されます。)
パブリック メソッド IsDefined  オーバーロードされます指定した型のカスタム属性が、アセンブリモジュール、型のメンバ、またはメソッド パラメータ適用されているかどうか判断します。 (Attribute から継承されます。)
パブリック メソッド Match  派生クラス内でオーバーライドされたときに、指定したオブジェクトとこのインスタンス等しかどうかを示す値を返します。 (Attribute から継承されます。)
パブリック メソッド ReferenceEquals  指定した複数Object インスタンス同一かどうか判断します。 (Object から継承されます。)
パブリック メソッド ToString  現在の Object を表す String返します。 (Object から継承されます。)
プロテクト メソッドプロテクト メソッド
参照参照

関連項目

ToolboxBitmapAttribute クラス
System.Drawing 名前空間


このページでは「.NET Framework クラス ライブラリ リファレンス」からToolboxBitmapAttributeを検索した結果を表示しています。
Weblioに収録されているすべての辞書からToolboxBitmapAttributeを検索する場合は、下記のリンクをクリックしてください。
 全ての辞書からToolboxBitmapAttribute を検索

英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「ToolboxBitmapAttribute」の関連用語

ToolboxBitmapAttributeのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



ToolboxBitmapAttributeのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2025 Microsoft.All rights reserved.

©2025 GRAS Group, Inc.RSS