zoukankan      html  css  js  c++  java
  • C# Winform 中DataGridView 实现单元格输入下拉框功能

    https://blog.csdn.net/ad13adsa/article/details/82108969

    private void dataGridViewX1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
            {
                e.Control.Controls.Clear();
                if (e.Control is DataGridViewTextBoxEditingControl && this.dataGridViewX1.CurrentCell.ColumnIndex == 1)
                {
                    ComboBoxEx btn = new ComboBoxEx();
                    e.Control.Controls.Add(btn);
                    btn.Dock = DockStyle.Fill;
                    btn.Cursor = Cursors.Default;
                    btn.DataSource = this.dclass.GetDataTable("select classid 编号,classname 名称 from WG_Class ");
                    btn.ValueMember = "编号";
                    btn.DisplayMember = "名称";
                    btn.SelectedValueChanged += delegate
                    {
                        this.dataGridViewX1.CurrentCell.Value = btn.Text;
                    };
                }
            }
    ---------------------
    作者:莱丝兰迪
    来源:CSDN
    原文:https://blog.csdn.net/ad13adsa/article/details/82108969
    版权声明:本文为博主原创文章,转载请附上博文链接!

  • 相关阅读:
    AIBigKaldi(二)| Kaldi的I/O机制(源码解析)
    OfficialKaldi(十四)| 从命令行角度来看Kaldi的 I / O
    GNU Make函数、变量、指令
    C/C++编码规范(google)
    [English]precede, be preceded by
    视频压缩技术、I帧、P帧、B帧
    SMB
    printf占位符
    使用 Yocto Project 构建自定义嵌入式 Linux 发行版
    gcc fpic fPIC
  • 原文地址:https://www.cnblogs.com/LuoEast/p/10619326.html
Copyright © 2011-2022 走看看