TabPage.ImageIndex プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > TabPage.ImageIndex プロパティの意味・解説 

TabPage.ImageIndex プロパティ

このタブ表示されているイメージインデックス取得または設定します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

<LocalizableAttribute(True)> _
Public Property ImageIndex As
 Integer
Dim instance As TabPage
Dim value As Integer

value = instance.ImageIndex

instance.ImageIndex = value
[LocalizableAttribute(true)] 
public int ImageIndex { get;
 set; }
[LocalizableAttribute(true)] 
public:
property int ImageIndex {
    int get ();
    void set (int value);
}
/** @property */
public int get_ImageIndex ()

/** @property */
public void set_ImageIndex (int
 value)
public function get ImageIndex
 () : int

public function set ImageIndex
 (value : int)

プロパティ
タブ表示される TabControl.ImageList のイメージの 0 から始まるインデックス番号既定値は -1 です。これはイメージがないことを示します

例外例外
例外種類条件

ArgumentException

ImageIndex の値が -1 未満です。

解説解説

ImageIndex は、TabControl の関連付けられた ImageList 内のいずれかイメージ示します

使用例使用例

1 つの TabPage がある TabControl作成するコード例次に示します。この例では、ImageIndex プロパティ使用してmyImages のどのイメージtabPage1タブ表示するかを指定してます。

この例では、System.DrawingSystem.ComponentModelSystem.Windows.FormsSystem.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()
        Dim myImages As New
 ImageList(components)

        tabControl1.Controls.Add(tabPage1)

        ' Displays images from myImages on the tabs of tabControl1.
        tabControl1.ImageList = myImages

        ' Specifies which image to display (on the tab of tabPage1)
 by its index.
        tabPage1.ImageIndex = 0

        tabPage1.Text = "tabPage1"

        myImages.ImageStream = CType(resources.GetObject("myImages.ImageStream"),
 ImageListStreamer)
        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();
        ImageList myImages = new ImageList(components);

        tabControl1.Controls.Add(tabPage1);

        // Displays images from myImages on the tabs of tabControl1.
        tabControl1.ImageList = myImages;

        // Specifies which image to display (on the tab of tabPage1)
 by its index.
        tabPage1.ImageIndex = 0;

        tabPage1.Text = "tabPage1";

        myImages.ImageStream = ((ImageListStreamer)(resources.GetObject("myImages.ImageStream")));
        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;
      ImageList^ myImages = gcnew ImageList( components );
      tabControl1->Controls->Add( tabPage1 );
      
      // Displays images from myImages on the tabs of tabControl1.
      tabControl1->ImageList = myImages;
      
      // Specifies which image to display (on the tab of tabPage1) by
 its index.
      tabPage1->ImageIndex = 0;
      tabPage1->Text = "tabPage1";
      myImages->ImageStream = (dynamic_cast<ImageListStreamer^>(resources->GetObject(
 "myImages.ImageStream" )));
      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();
        ImageList myImages = new ImageList(components);

        tabControl1.get_Controls().Add(tabPage1);
        // Displays images from myImages on the tabs of tabControl1.
        tabControl1.set_ImageList(myImages);
        // Specifies which image to display (on the tab of tabPage1)
 by its
        // index.
        tabPage1.set_ImageIndex(0);

        tabPage1.set_Text("tabPage1");

        myImages.set_ImageStream(((ImageListStreamer)(
            resources.GetObject("myImages.ImageStream"))));
        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
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照


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

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

辞書ショートカット

すべての辞書の索引

TabPage.ImageIndex プロパティのお隣キーワード
検索ランキング

   

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



TabPage.ImageIndex プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

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

©2025 GRAS Group, Inc.RSS