zoukankan      html  css  js  c++  java
  • 下拉框(多选|单选)总结—(一)

        好久没有来博客园了,抽空总结下用过的下拉框吧

    一.DEV控件CheckedComboBoxEdit(工具箱—>Common Control—>CheckedComboBoxEdit)

     1  //说明:若ShowButtons属性为true,则显示OK和Cancel按钮;
     2             //若ShowButtons属性为true,ShowPopupCloseButton为false,则显示OK,不显示Cancel按钮
     3             //若ShowButtons属性为false,ShowPopupCloseButton为true,则下拉框左下角会显示×表示取消;
     4             //若二者都为false,都按钮和×都不显示   以上情况可以在实际中进行试验(亲测,觉得这俩属性做的很细致)
     5             checkedComboBoxEdit1.Properties.ShowButtons = true;//是否显示“OK”,和Cancel按钮
     6             checkedComboBoxEdit1.Properties.ShowPopupCloseButton = false;//是否显示Cancel
     7 
     8             checkedComboBoxEdit1.Properties.SelectAllItemCaption = "全选";//默认为"Select All"
     9             checkedComboBoxEdit1.Properties.SelectAllItemVisible = true;//全选框是否可见
    10             checkedComboBoxEdit1.Properties.SeparatorChar = ','; //多选时显示值的分割符(默认,)
    常用属性
     1       //法①
     2             List<string> lstData = new List<string>();
     3             lstData.Add("aa");
     4             lstData.Add("bb");
     5             lstData.Add("cc");
     6             checkedComboBoxEdit1.Properties.DataSource = lstData;
     7 
     8      // 法②
     9          string[]  strViewName = new string[] { "A", "B", "C" };
    10           for (int i = 0; i < strViewName.Length; i++)
    11           {
    12               string str = "显示值" + "-" + i.ToString();
    13               //参数说明:绑定的实际值,显示值,选项默认是否选中,最后一个参数是选择项是否可用
    14               checkedComboBoxEdit1.Properties.Items.Add(strViewName[i], str, CheckState.Unchecked, true);
    15           }
    绑定数据源
    1   //获取到实际的绑定的值
    2                 List<object> lst = checkedComboBoxEdit1.Properties.Items.GetCheckedValues();
    3                 
    4                 //获取到的显示值
    5                 string strText = checkedComboBoxEdit1.Text;
    6                 string[] strGetData = strText.Split(',');
    获checkedComboBoxEdit1的值
  • 相关阅读:
    .NET性能调优之三:YSlow相关规则的调优工具和方法
    .NET性能调优之二:使用Visual Studio进行代码度量
    OSPF的常见前7类LSA详解
    Packet Tracer 5.3搭建DNS服务器
    中型网络中网络冗余设计的要领
    GNS3模拟器如何保存配置文件
    CCNA相当综合的实验1
    GNS模拟器中支持的模块说明
    典型配置:H3C基于AP限制接入客户端数量
    破解H3C交换机密码的方法
  • 原文地址:https://www.cnblogs.com/mengzhixingping/p/8522097.html
Copyright © 2011-2022 走看看