TabControl.ImageList 속성
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
컨트롤의 탭에 표시할 이미지를 가져오거나 설정합니다.
public:
property System::Windows::Forms::ImageList ^ ImageList { System::Windows::Forms::ImageList ^ get(); void set(System::Windows::Forms::ImageList ^ value); };
public System.Windows.Forms.ImageList ImageList { get; set; }
member this.ImageList : System.Windows.Forms.ImageList with get, set
Public Property ImageList As ImageList
속성 값
탭에 표시할 이미지를 지정하는 ImageList입니다.
예제
다음 코드 예제에서는 하나를 TabPage사용하여 TabControl 만듭니다. 이 예제에서는 속성을 사용하여 ImageList 명명myImages
된 ImageList 컬렉션의 이미지를 탭에 표시합니다tabControl1
.
using namespace System::Drawing;
using namespace System::ComponentModel;
using namespace System::Windows::Forms;
using namespace System::Resources;
public ref class Form1: public Form
{
public:
Form1()
{
IContainer^ components = gcnew System::ComponentModel::Container;
ResourceManager^ resources = gcnew ResourceManager( Form1::typeid );
TabControl^ tabControl1 = gcnew TabControl;
TabPage^ tabPage1 = gcnew TabPage;
// Declares and instantiates the ImageList Object*.
ImageList^ myImages = gcnew ImageList( components );
tabControl1->Controls->Add( tabPage1 );
// Sets the images in myImages to display on the tabs of tabControl1.
tabControl1->ImageList = myImages;
tabPage1->ImageIndex = 0;
tabPage1->Text = "tabPage1";
// Gets the handle that provides the data of myImages.
myImages->ImageStream = (dynamic_cast<ImageListStreamer^>(resources->GetObject( "myImages.ImageStream" )));
// Sets properties of myImages.
myImages->ColorDepth = ColorDepth::Depth8Bit;
myImages->ImageSize = System::Drawing::Size( 16, 16 );
myImages->TransparentColor = Color::Transparent;
this->Controls->Add( tabControl1 );
}
};
int main()
{
Application::Run( gcnew Form1 );
}
using System.Drawing;
using System.ComponentModel;
using System.Windows.Forms;
using System.Resources;
public class Form1 : Form
{
public Form1()
{
IContainer components = new Container();
ResourceManager resources = new ResourceManager(typeof(Form1));
TabControl tabControl1 = new TabControl();
TabPage tabPage1 = new TabPage();
// Declares and instantiates the ImageList object.
ImageList myImages = new ImageList(components);
tabControl1.Controls.Add(tabPage1);
// Sets the images in myImages to display on the tabs of tabControl1.
tabControl1.ImageList = myImages;
tabPage1.ImageIndex = 0;
tabPage1.Text = "tabPage1";
// Gets the handle that provides the data of myImages.
myImages.ImageStream = ((ImageListStreamer)(resources.GetObject("myImages.ImageStream")));
// Sets properties of myImages.
myImages.ColorDepth = ColorDepth.Depth8Bit;
myImages.ImageSize = new Size(16, 16);
myImages.TransparentColor = Color.Transparent;
this.Controls.Add(tabControl1);
}
static void Main()
{
Application.Run(new Form1());
}
}
Imports System.Drawing
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Resources
Public Class Form1
Inherits Form
Public Sub New()
Dim components = New Container()
Dim resources As New ResourceManager(GetType(Form1))
Dim tabControl1 As New TabControl()
Dim tabPage1 As New TabPage()
' Declares and instantiates the ImageList object.
Dim myImages As New ImageList(components)
tabControl1.Controls.Add(tabPage1)
' Sets the images in myImages to display on the tabs of tabControl1.
tabControl1.ImageList = myImages
tabPage1.ImageIndex = 0
tabPage1.Text = "tabPage1"
' Gets the handle that provides the data of myImages.
myImages.ImageStream = CType(resources.GetObject("myImages.ImageStream"), ImageListStreamer)
' Sets properties of myImages.
myImages.ColorDepth = ColorDepth.Depth8Bit
myImages.ImageSize = New Size(16, 16)
myImages.TransparentColor = Color.Transparent
Me.Controls.Add(tabControl1)
End Sub
Shared Sub Main()
Application.Run(New Form1())
End Sub
End Class
설명
탭에 이미지를 표시하려면 해당 TabPage속성을 설정합니다ImageIndex. 인 ImageIndex 덱 ImageList스 역할을 합니다.