TabControl.ImageList-Eigenschaft
Ruft die auf den Registerkarten des Steuerelements anzuzeigenden Bilder ab oder legt diese fest.
Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)
Syntax
'Declaration
Public Property ImageList As ImageList
'Usage
Dim instance As TabControl
Dim value As ImageList
value = instance.ImageList
instance.ImageList = value
public ImageList ImageList { get; set; }
public:
property ImageList^ ImageList {
ImageList^ get ();
void set (ImageList^ value);
}
/** @property */
public ImageList get_ImageList ()
/** @property */
public void set_ImageList (ImageList value)
public function get ImageList () : ImageList
public function set ImageList (value : ImageList)
Eigenschaftenwert
Eine ImageList, die die auf den Registerkarten anzuzeigenden Bilder angibt.
Hinweise
Um auf einer Registerkarte ein Bild anzeigen zu lassen, legen Sie die ImageIndex-Eigenschaft dieser TabPage fest. ImageIndex fungiert als Index für ImageList.
Beispiel
Im folgenden Beispiel wird ein TabControl mit einer TabPage erstellt. In diesem Beispiel wird die ImageList-Eigenschaft verwendet, um auf den Registerkarten von tabControl1
Bilder aus der Auflistung anzuzeigen, die von der ImageListmyImages
definiert wird.
Verwenden Sie für dieses Beispiel die folgenden Namespaces: System.Drawing, System.ComponentModel , System.Windows.Forms und System.Resources.
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
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());
}
}
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 );
}
import System.Drawing.*;
import System.ComponentModel.*;
import System.Windows.Forms.*;
import System.Resources.*;
public class Form1 extends Form
{
public Form1()
{
IContainer components = new Container();
ResourceManager resources = new ResourceManager(Form1.class.ToType());
TabControl tabControl1 = new TabControl();
TabPage tabPage1 = new TabPage();
// Declares and instantiates the ImageList object.
ImageList myImages = new ImageList(components);
tabControl1.get_Controls().Add(tabPage1);
// Sets the images in myImages to display on the tabs of tabControl1.
tabControl1.set_ImageList(myImages);
tabPage1.set_ImageIndex(0);
tabPage1.set_Text("tabPage1");
// Gets the handle that provides the data of myImages.
myImages.set_ImageStream(((ImageListStreamer)resources.
GetObject("myImages.ImageStream")));
// Sets properties of myImages.
myImages.set_ColorDepth(ColorDepth.Depth8Bit);
myImages.set_ImageSize(new Size(16, 16));
myImages.set_TransparentColor(Color.get_Transparent());
this.get_Controls().Add(tabControl1);
} //Form1
public static void main(String[] args)
{
Application.Run(new Form1());
} //main
} //Form1
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
Siehe auch
Referenz
TabControl-Klasse
TabControl-Member
System.Windows.Forms-Namespace
ImageList-Klasse