zoukankan      html  css  js  c++  java
  • Winfor DataGridView选中行数量

    List<int> selectedRowsIndex = new List<int>();

    List<DataGridViewRow> selecteRows = new List<DataGridViewRow>();
    foreach(DataGridViewRow r in this.dataGridView1.Rows)
    {
             foreach (DataGridViewCell c in r.Cells)
             if (c.Selected && !selectedRowsIndex.Contains(c.RowIndex))
             {
                      selectedRowsIndex.Add(c.RowIndex);
                      selecteRows.Add(r);
              }
    }
     
    if (selectedRowsIndex.Count > 1)
    {                    
             if (MessageBox.Show("确定删除" + selectedRowsIndex.Count.ToString() + "行数据吗?""删除前7a686964616fe59b9ee7ad9431333431343063确认", MessageBoxButtons.YesNo) == DialogResult.Yes)
             {
                    foreach (DataGridViewRow r in selecteRows)
                      this.dataGridView1.Rows.Remove(r);
             }
    }
     
     
     
    Ctrl+A全选
    给DataGridView添加KeyDown事件
    /// <summary>
            /// 全选
            /// </summary>
            /// <param name="sender"></param>
      ///按Ctrl+a时 数量显示为总数量
            /// <param name="e"></param>
            private void ManaginPeopleList_KeyDown(object sender, KeyEventArgs e)
            {
                if (e.Control && e.KeyCode == Keys.A)
                {
                    refrelogcount(ListCount, ListCount);
                }
            }
     
     
    Combox实现输入文字 在下拉列表中提示
    Combox绑定List数据
    ComboBox的AutoCompleteMode属性置为SuggestAppend,AutoCompleteSource属性置为ListItems
     
     
     
     
    扩展:
    AutoCompleteMode允许有四种值:

    None:默认值,指示ComboBox不使用自动功能。
    Suggest:在ComboBox中输入字符后,ComboBox会自动展开,显示匹配的子项,输入行不受影响,需要自己输入后续字符,或者在下拉框中点选完整子项。
    Append:输入字符后,字符后会自动补充匹配内容(以反色显示),但是ComboBox不会展开。按上下键可以在多个匹配内容中切换。
    SuggestAppend:上述两种模式的组合。

    AutoCompleteSource属性,共有9种,指示自动完成将要在其中进行查找的数据源。常用的几种如下:

    ListItems:数据源为ComboBox的Item集合。
    FileSystem:文件系统。例如输入c:后会展开c:下的目录列表(或append模式下的自动添加)。同样的,此数据源也支持文件名的补全。
    CustomSource:自定义数据源。选用此方式时必须在代码中指定ComboBox的AutoCompleteCustomSource属性为你构建的AutoCompleteStringCollection对象,否则不会生效。AutoCompleteStringCollection类似于List<string>,将你的数据add进去即可。
    采用自www.360doc.com/showweb/0/0/911613131.aspx
     
  • 相关阅读:
    服务器×××上的MSDTC不可用解决办法
    安装VS2010后,更改iis的asp.net版本
    刷新后 页面 保持滚动条位置
    Atitit.java 反编译 工具  attilax 总结
    Atitit.收银系统模块架构attilax 总结
    Atitit.论垃圾文件的识别与清理 文档类型垃圾文件 与api概要设计pa6.doc
    atitit.guice3 绑定方式打总结生成非单例对象toInstance toProvider区别 v2 pb29
    Atitit. Derby的使用总结attilax
    Atitit.attilax的 case list 项目经验 案例列表
    Atitit.收银系统pos 以及打印功能的行业标准
  • 原文地址:https://www.cnblogs.com/liangweitao/p/12867374.html
Copyright © 2011-2022 走看看