zoukankan      html  css  js  c++  java
  • ListView hide column by easy way

    ListView hide column by easy way

    用简单方式隐藏ListView中的列

    lvData.Columns[5].Width=0;

    and

    并且

    lvData.ColumnWidthChanging += new ColumnWidthChangingEventHandler(lvMatchupList_ColumnWidthChanging);
    void lvMatchupList_ColumnWidthChanging(object sender, ColumnWidthChangingEventArgs e)
    {
    if (e.ColumnIndex == 5 && e.NewWidth > 0)
    e.Cancel = true;
    }

    if no effects because

    可能会没有效果,因为

    In order to receive the ListView::ColumnWidthChanging, you need to enable full dragging of windows.

    Here is how to enable full dragging of windows:
    1. Go to Control Panel
    2. Click on Display
    3. On the "Display Properties" dialog go to "Appereance" tab
    4. On the "Appearance" tab click on "Effects" button - this will open the "Effects" dialog.
    5. On the "Effects" dialog see if the "Show windows contents while dragging" check box is checked. If the check box is not checked, then check it.
    6. Close the "Effects" dialog and then the "Display Properties" dialog.

    Now full dragging of windows should be enabled on your machine and the ListView should fire the ColumnWidthChanging event.

    another way

    另一种实现

    lvData.ColumnWidthChanged += new ColumnWidthChangedEventHandler(lvMatchupList_ColumnWidthChanged);
    void lvMatchupList_ColumnWidthChanged(object sender, ColumnWidthChangedEventArgs e)
    {
    if (e.ColumnIndex == 5 && lvData.Columns[5].Width > 0)
    lvData.Columns[5].Width = 0;
    }



  • 相关阅读:
    Annotation Type ManyToMany->>>>>Oracle
    windows 控制台默认为UTF-8显示的方法
    springboot读取配置文件
    Spring Boot配置文件放在jar外部
    Vue自定义过滤器
    vue中limitBy,filterBy,orderBy的用法
    track-by的使用
    Vue的computed属性
    vue实现百度下拉框
    Cas服务器以及客户端搭建
  • 原文地址:https://www.cnblogs.com/eshizhan/p/2385008.html
Copyright © 2011-2022 走看看