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的值
  • 相关阅读:
    supervisord + docker run = web页面管理运行的docker
    docker之Dockerfile实践用dockerfile构建nginx环境
    Dockerfile文件详解
    【docker】CMD ENTRYPOINT 区别 终极解读!
    golang html/template
    网络连接带宽的理论最大值
    Queue length 和 Queue depth 的区别
    .tar.gz 文件和 .tar.xz 文件的区别
    如何同时在Isilon的所有网卡上抓取网络包?
    Reimage Isilon cluster,结果忘记了修改管理口的netmask,怎么办?
  • 原文地址:https://www.cnblogs.com/mengzhixingping/p/8522097.html
Copyright © 2011-2022 走看看