zoukankan      html  css  js  c++  java
  • 控件的用法ComboBox;RadionButton;Timer;DataGridView

    ComboBox:组合框---属性:

    Text:选中的值

    Items:组合框中的项

    Add:添加单个的值

    AddRange:添加多个的值

    SelectedIndex:索引值  

    SelectedValue:隐藏值                                                                  

    DropDownStyle:下拉框样式

    Remove:删除

    Clear:清除

    例:

    //选中文本框的值

    var txt=this.ComboBox.Text;

    //添加单个的值

    this.ComboBox.Add("小黑");

    //添加多个的值

    string[]strs={"小黑","小米"};

    this.ComboBox.AddRange("小黑");

    //选中第一个值

    this.ComboBox.SelectedIndex=0;

    //隐藏值

    this.ComboBox.SelectedValue=;

    //获取隐藏值

    var sReceivablesType = cbo_ReceivablesType.SelectedValue;

    //下拉框样式设置为只读

    this.ComboBox.DropDownStyle=ComboBoxStyle.DropDownList;

    //删除选中的值

    this.ComboBox = Items.Remove(txt);

    //清除选中的值

    this.ComboBox = Items.Clear(txt);

    //一个List<类>的数据源 获取户型
    var housesTypeList = HousesTypeProxyService.GetInstance().GetListByBuildSysNoToDropList(BuildingSysNo);
    if (housesTypeList == null)
             return;

    //绑定数据源

    cbo_UnitInfo.DisplayMember = "UnitName";
                cbo_UnitInfo.ValueMember = "SysNo";
                cbo_UnitInfo.DataSource = housesUnitList;

     //获取下拉框选中的Dto类

     var list = cbo_UnitInfo.DataSource as List<HousesTypeDto>; //取得户型
                if (list == null) return;
                var index = cbo_Odd.SelectedIndex;
                var housesTypeDto = list[index];

    ---事件:SelectedIndexChanged:下拉框列表发生改变时触发的事件

    RadionButton:单选按钮---属性:

    Checked:是否选中

    例:

    if(this.RadionButton.Checked){

      MessagerBox.Show("选中");

    }else{

      MessagerBox.Show("没选中");

    }                                                                                             

    Timer:时钟控件---属性:

    InterVal:时间间隔,单位是毫秒

    Enavles:开启时钟

    例:

    //获取当前时间

    DateTime dt=DateTime.Now;

    //开启时钟

    this.timerl.Start();

    //设置时间间隔

    this.timerl.InterVal=1000;

    //停止时钟

    this.timerl.stop();

    DataGridView:黑道

    绑定值:this.DataGridView.DataSource=table;

    选中值:this.DataGridView.SelectedItems[0].Cells[0].Valus.tostring();

     获取当前选择的一行SysNo属性的值:var sysNo = dgv_MessageList.CurrentRow.Cells["SysNo"].Value.ToString();

  • 相关阅读:
    TP6框架中如何无刷新上传文件
    TP6框架设置验证码的宽度和高度后,验证码显示不全
    TP6模板缓存问题
    TP6管理后台实战第五天文章管理
    20211027技术人为什么建议写博客
    TP6管理后台实战第六天系统管理
    博客园自定义菜单
    xcat无法连接服务器
    lsf安装后配置
    xcat网络无盘启动——添加自定义安装包
  • 原文地址:https://www.cnblogs.com/denglj/p/3841041.html
Copyright © 2011-2022 走看看