zoukankan      html  css  js  c++  java
  • 控制DataGirdView中單元格

    this.dataGridView1.EditingControlShowing += new DataGridViewEditingControlShowingEventHandler(dataGridView1_EditingControlShowing);

    void dataGridView1_EditingControlShowing(object sender, DataGridViewEditingControlShowingEventArgs e)
      {
       if (e.Control is DataGridViewComboBoxEditingControl)
       {
        if (!isRegedit)
        {
         ((DataGridViewComboBoxEditingControl)e.Control).DropDown += new EventHandler(uclMPODetailListView_DropDown);
         ((DataGridViewComboBoxEditingControl)e.Control).SelectedIndexChanged += new EventHandler(uclMPODetailListView_SelectedIndexChanged);
         ((DataGridViewComboBoxEditingControl)e.Control).KeyDown += new KeyEventHandler(uclMPODetailListView_KeyDown);
         isRegedit = true;
        }

       }
       else
       {
        isRegedit = false;
       }

       if (e.Control is ImageButtonTextBoxEditingControl)
       {
        if (dataGridView1.CurrentCell.ColumnIndex == 0)
        {
         //if (!((ImageButtonTextBoxEditingControl)e.Control).HasRegedited)
         //{
         ((ImageButtonTextBoxEditingControl)e.Control).ReSetClickEvent();
         ((ImageButtonTextBoxEditingControl)e.Control).imageButtonClicked += new EventHandler(uclMPODetailListViewMO_imageButtonClicked);
          //((ImageButtonTextBoxEditingControl)e.Control).HasRegedited = true;
         //}
        }

        if (dataGridView1.CurrentCell.ColumnIndex == 18)
        {
                        ((ImageButtonTextBoxEditingControl)e.Control).KeyPress += new KeyPressEventHandler(imageCtrl_KeyPress);
         ((ImageButtonTextBoxEditingControl)e.Control).ReSetClickEvent();
         ((ImageButtonTextBoxEditingControl)e.Control).imageButtonClicked += new EventHandler(uclMPODetailListViewPO_imageButtonClicked);
        }
       }
      }

            void imageCtrl_KeyPress(object sender, KeyPressEventArgs e)
            {
                e.Handled = true;
            }

  • 相关阅读:
    css选择符有哪些?哪些属性可以继承?优先级算法如何计算?内联和important哪个优先
    移动端重要的几个CSS3属性设置
    关于移动端的Click事件
    JS根据key值获取URL中的参数值,以及把URL的参数转换成json对象
    动态添加JS文件到页面
    JS 模拟C# 字符串格式化操作
    JS cookie 读写操作
    很好用的Tab标签切换功能,延迟Tab切换。
    SpringMVC 原理
    SpringMVC 三种异常处理方式
  • 原文地址:https://www.cnblogs.com/springxie/p/1509542.html
Copyright © 2011-2022 走看看