ToolboxBitmapAttribute 클래스

정의

Microsoft Visual Studio 양식 디자이너와 같이 컨테이너의 컨트롤을 나타내는 아이콘을 지정할 수 있습니다.

public ref class ToolboxBitmapAttribute : Attribute
[System.AttributeUsage(System.AttributeTargets.Class)]
public class ToolboxBitmapAttribute : Attribute
[<System.AttributeUsage(System.AttributeTargets.Class)>]
type ToolboxBitmapAttribute = class
    inherit Attribute
Public Class ToolboxBitmapAttribute
Inherits Attribute
상속
ToolboxBitmapAttribute
특성

예제

다음 코드 예제에서는 클래스를 사용 하 여 ToolboxBitmapAttribute 도구 상자 아이콘으로 설정 stop.bmp 하는 방법을 보여 줍니다 StopSignControl. 이 예제에서는 c:\에 이름이 지정된 16 x 16픽셀 비트맵이 있다고 stop.bmp 가정합니다.

[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;
    }

};
[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;
    }
}
<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

설명

Microsoft Visual Studio 양식 디자이너와 같은 컨테이너가 컨트롤을 나타내는 아이콘을 검색할 수 있도록 컨트롤에 ToolboxBitmapAttribute 적용할 수 있습니다. 아이콘의 비트맵은 파일 자체에 있거나 컨트롤이 포함된 어셈블리에 포함될 수 있습니다. 컨트롤의 어셈블리에 포함하거나 별도의 파일에 저장하는 비트맵의 크기는 16x16이어야 합니다. 개체의 ToolboxBitmapAttribute 메서드는 GetImage 작은 16 by 16 이미지 또는 작은 이미지의 크기를 조정하여 만드는 큰 32 by 32 이미지를 반환할 수 있습니다.

다른 버전의 어셈블리에서 다른 버전의 아이콘을 사용하려는 경우 각 버전에 대해 수정 ToolboxBitmapAttribute 할 필요가 없습니다. 대신, 어셈블리를 a 또는 a BitmapSuffixInSameAssemblyAttributeBitmapSuffixInSatelliteAssemblyAttribute로 선언하고 각 어셈블리 버전에 대한 구성 값을 지정할 BitmapSuffix 수 있습니다. 이 경우 a로 표시된 ToolboxBitmapAttribute 파일 이름은 비트맵 접미사가 추가된 상태로 해석됩니다.

생성자

Name Description
ToolboxBitmapAttribute(String)

지정된 파일의 이미지를 사용하여 새 ToolboxBitmapAttribute 개체를 초기화합니다.

ToolboxBitmapAttribute(Type, String)

지정된 어셈블리에 리소스로 포함된 16 by 16 비트맵을 기반으로 새 ToolboxBitmapAttribute 개체를 초기화합니다.

ToolboxBitmapAttribute(Type)

지정된 어셈블리에 리소스로 포함된 16 x 16 비트맵을 기반으로 새 ToolboxBitmapAttribute 개체를 초기화합니다.

필드

Name Description
Default

ToolboxBitmapAttribute 작은 이미지와 큰 이미지가 .로 null설정된 개체입니다.

속성

Name Description
TypeId

파생 클래스에서 구현되는 경우 이 Attribute대한 고유 식별자를 가져옵니다.

(다음에서 상속됨 Attribute)

메서드

Name Description
Equals(Object)

지정한 개체가 개체이고 이 ToolboxBitmapAttribute 개체 ToolboxBitmapAttribute 와 동일한지 여부를 나타냅니다.

GetHashCode()

ToolboxBitmapAttribute 개체에 대한 해시 코드를 가져옵니다.

GetImage(Object, Boolean)

ToolboxBitmapAttribute 개체와 연결된 작거나 큰 Image 개체를 가져옵니다.

GetImage(Object)

ToolboxBitmapAttribute 개체와 연결된 작은 Image 개체를 가져옵니다.

GetImage(Type, Boolean)

ToolboxBitmapAttribute 개체와 연결된 작거나 큰 Image 개체를 가져옵니다.

GetImage(Type, String, Boolean)

ToolboxBitmapAttribute 개체와 연결된 작거나 큰 Image 개체를 가져옵니다.

GetImage(Type)

ToolboxBitmapAttribute 개체와 연결된 작은 Image 개체를 가져옵니다.

GetImageFromResource(Type, String, Boolean)

Image 어셈블리에 포함된 비트맵 리소스를 기반으로 개체를 반환합니다.

GetType()

현재 인스턴스의 Type 가져옵니다.

(다음에서 상속됨 Object)
IsDefaultAttribute()

파생 클래스에서 재정의되는 경우 이 인스턴스의 값이 파생 클래스의 기본값인지 여부를 나타냅니다.

(다음에서 상속됨 Attribute)
Match(Object)

파생 클래스에서 재정의되는 경우 이 인스턴스가 지정된 개체와 같은지 여부를 나타내는 값을 반환합니다.

(다음에서 상속됨 Attribute)
MemberwiseClone()

현재 Object단순 복사본을 만듭니다.

(다음에서 상속됨 Object)
ToString()

현재 개체를 나타내는 문자열을 반환합니다.

(다음에서 상속됨 Object)

명시적 인터페이스 구현

Name Description
_Attribute.GetIDsOfNames(Guid, IntPtr, UInt32, UInt32, IntPtr)

이름 집합을 해당 디스패치 식별자 집합에 매핑합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfo(UInt32, UInt32, IntPtr)

인터페이스의 형식 정보를 가져오는 데 사용할 수 있는 개체의 형식 정보를 검색합니다.

(다음에서 상속됨 Attribute)
_Attribute.GetTypeInfoCount(UInt32)

개체가 제공하는 형식 정보 인터페이스의 수를 검색합니다(0 또는 1).

(다음에서 상속됨 Attribute)
_Attribute.Invoke(UInt32, Guid, UInt32, Int16, IntPtr, IntPtr, IntPtr, IntPtr)

개체에 의해 노출되는 속성 및 메서드에 대한 액세스를 제공합니다.

(다음에서 상속됨 Attribute)

적용 대상