0
0

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 5 years have passed since last update.

(.NET) リストビューのカラムヘッダに設定したアイコンを消す方法

Last updated at Posted at 2013-07-03

概要

ColumnHeader.ImageIndex を設定することでリストビューのカラムにアイコンを表示することができますが、
これを消すのはちょっとコツがいりますよ、というお話。

ダメな例

ColumnHeader.ImageIndex を -1 に戻すだけじゃダメなんです。

ListView view;
int col;
view.Columns[col].ImageIndex = -1;

解決方法

ColumnHeader.ImageIndex を -1 に戻すのに加えて
ColumnHeader.TextAlign を設定しなおすと、ちゃんとアイコンが消えます。

ListView view;
int col;
view.Columns[col].ImageIndex = -1;
view.Columns[col].TextAlign = view.Columns[col].TextAlign;

とってもバッドなノウハウですね。Microsoft の実装が悪いと思う。

関連フォーラム記事

How to remove picture(icon) from listview column header [VB 2008]

0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?