如何隐藏ListView控件中的列? [英] How to hide a column in a ListView control?

查看:391
本文介绍了如何隐藏ListView控件中的列?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在ListView控件中隐藏列,而不将列Width属性设置为0?

How can I hide a column in a ListView control, without setting the column Width property to 0?

还可以锁定列的Width吗?

推荐答案

对于C++Cli标记,这里不是很清楚,但是:

Not very clear what matters here C++Cli tag, but:

我假设,如果您要谈论的是ListView中的列,那么您将进入控件的详细信息视图.据我所知,在ListView中没有内置的隐藏/显示"列方式,因此解决方案之一就是仅从UI中删除该列.

I presume that if you're talking about a columns in ListView, you're in details view of the control. There is no builtin Hide/Show column way in ListView, as much as I'm aware of, so one of solutions can be just remove that column form UI.

要尽可能以最流畅的方式进行操作,只需在

To do that in most smooth way possible just call your ListView column regeneration code in between

listView.SuspendLayout(true);

/*Manipulate column here*/

listView.ResumeLayout();

ListView上可见的数据始终保持在您的手中,因此此刻您将决定再次显示该列,只需显示该列并再次填充ListView.

The data which is visible on ListView always remains "in your hands", so at the moment you will decide to show the column again, just show the column and fill ListView again.

希望这会有所帮助.

这篇关于如何隐藏ListView控件中的列?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆