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;
            }

  • 相关阅读:
    ex3多类问题和NN中的前向传播
    逻辑关系下的NN应用
    NN-Neural Network
    ex2:逻辑回归及正则条件下的练习
    Overfitting&Underfitting Problems
    操作系统内存管理之虚拟内存
    C陷阱与缺陷读书笔记(三)
    操作系统常见面试题
    计算机网络常考面试题总结
    堆及堆排序
  • 原文地址:https://www.cnblogs.com/springxie/p/1509542.html
Copyright © 2011-2022 走看看