3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

C#のタブコントロールの外観を変更する

Posted at

1. はじめに

  • C#のWindownsフォームアプリのタブコントロールの外観を変更したい

    • 変更前
      image.png

    • 変更後
      image.png

2. 開発環境

  • C#
  • .NET 6 (Windowsフォームアプリ)
  • Visual Studio 2022
  • Windows 11

3. タブコントロールの配置

  • ツールボックスからFormにTabContorlをドラッグ&ドロップする

image.png

  • TabControlのDockをFillに変更する(タブコントロールをフォーム全体に表示)

image.png

4. タブコントロールのコード

  • コンストラクタにタブのサイズ、横幅固定の記述を追加する
public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();

        // タブのサイズを変更
        this.tabControl1.ItemSize = new Size(240, 40);

        // タブの横幅を固定
        this.tabControl1.SizeMode = TabSizeMode.Fixed;
    }
}

5. 動作確認

  • デフォルトのタブより外観が少し良くなった
    image.png

6. 参考文献

3
4
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?