ToolboxBitmapAttribute 생성자
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
새 ToolboxBitmapAttribute 개체를 초기화합니다.
오버로드
ToolboxBitmapAttribute(String) |
지정된 파일에서 이미지가 있는 새 ToolboxBitmapAttribute 개체를 초기화합니다. |
ToolboxBitmapAttribute(Type) |
지정된 어셈블리에 리소스로 포함된 16 x 16 비트맵을 기준으로 새 ToolboxBitmapAttribute 개체를 초기화합니다. |
ToolboxBitmapAttribute(Type, String) |
지정된 어셈블리에 리소스로 포함된 16 x 16 비트맵을 기준으로 새 ToolboxBitmapAttribute 개체를 초기화합니다. |
ToolboxBitmapAttribute(String)
- Source:
- ToolboxBitmapAttribute.cs
- Source:
- ToolboxBitmapAttribute.cs
- Source:
- ToolboxBitmapAttribute.cs
지정된 파일에서 이미지가 있는 새 ToolboxBitmapAttribute 개체를 초기화합니다.
public:
ToolboxBitmapAttribute(System::String ^ imageFile);
public ToolboxBitmapAttribute (string imageFile);
new System.Drawing.ToolboxBitmapAttribute : string -> System.Drawing.ToolboxBitmapAttribute
Public Sub New (imageFile As String)
매개 변수
- imageFile
- String
16 x 16 비트맵이 있는 파일 이름입니다.
예제
다음 코드 예제를 사용 ToolboxBitmapAttribute 하는 방법에 설명 합니다 생성자를 에 대 한 도구 상자 아이콘으로 설정 stop.bmp
합니다 StopSignControl
. 이 예제에서는 c:\라는 16x16픽셀 비트맵이 있다고 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
적용 대상
ToolboxBitmapAttribute(Type)
- Source:
- ToolboxBitmapAttribute.cs
- Source:
- ToolboxBitmapAttribute.cs
- Source:
- ToolboxBitmapAttribute.cs
지정된 어셈블리에 리소스로 포함된 16 x 16 비트맵을 기준으로 새 ToolboxBitmapAttribute 개체를 초기화합니다.
public:
ToolboxBitmapAttribute(Type ^ t);
public ToolboxBitmapAttribute (Type t);
new System.Drawing.ToolboxBitmapAttribute : Type -> System.Drawing.ToolboxBitmapAttribute
Public Sub New (t As Type)
매개 변수
예제
다음 코드 예제에서는 사용 하는 ToolboxBitmapAttribute 방법을 보여 줍니다는 라는 의 도구 상자 아이콘에 단추 컨트롤의 아이콘을 설정 하는 생성자입니다 UserControlStopSignControl3
.
[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;
}
};
[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;
}
}
<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
설명
이 생성자는 매개 변수로 지정된 형식을 정의하는 어셈블리의 포함된 리소스를 t
검색합니다. 생성자는 namespace.classname.bmp 라는 리소스를 검색합니다. 여기서 네임스페이스는 매개 변수로 지정된 클래스의 정의를 포함하는 네임스페이 t
스입니다. 예를 들어 ControlA가 AssemblyA.dll 네임스페이스A에 있는 경우 생성자는 AssemblyA.dll NamespaceA.ControlA.bmp 리소스를 검색합니다.
적용 대상
ToolboxBitmapAttribute(Type, String)
- Source:
- ToolboxBitmapAttribute.cs
- Source:
- ToolboxBitmapAttribute.cs
- Source:
- ToolboxBitmapAttribute.cs
지정된 어셈블리에 리소스로 포함된 16 x 16 비트맵을 기준으로 새 ToolboxBitmapAttribute 개체를 초기화합니다.
public:
ToolboxBitmapAttribute(Type ^ t, System::String ^ name);
public ToolboxBitmapAttribute (Type t, string name);
new System.Drawing.ToolboxBitmapAttribute : Type * string -> System.Drawing.ToolboxBitmapAttribute
Public Sub New (t As Type, name As String)
매개 변수
- name
- String
포함된 비트맵 리소스의 이름입니다.
예제
'다음 코드 예제에서는 에 대 한 도구 상자 아이콘으로 설정 StopSignControl2.bmp
하는 생성자를 사용 ToolboxBitmapAttribute 하는 방법을 보여 줍니다StopSignControl2
. 이 예제에서는 BuildAction 속성이 EmbeddedResource로 설정된 16x16픽셀 비트맵이 있다고 StopSignControl2.bmp
가정합니다.
[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;
}
};
[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;
}
}
<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
설명
이 생성자는 매개 변수로 지정된 형식을 정의하는 어셈블리의 포함된 리소스를 t
검색합니다. 생성자는 namespace.name 라는 리소스를 검색합니다. 여기서 네임스페이스는 매개 변수로 지정된 클래스의 정의를 포함하는 네임스페이 t
스입니다. 예를 들어 ControlA가 AssemblyA.dll NamespaceA의 클래스이고 매개 변수에 "MyBitmap.bmp" name
를 전달했다고 가정합니다. 그런 다음 생성자는 AssemblyA.dll NamespaceA.MyBitmap.bmp 리소스를 검색합니다.
적용 대상
.NET