• 控制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;
            }

  • 相关阅读:
    从B树、B+树、B*树谈到R 树
    The Log-Structured Merge-Tree(译)
    Leveldb源码分析--2
    Leveldb源码分析--1
    little-endian And big-endian
    Fixed数据类型
    Varint数值压缩存储方法
    JavaEE开发之SpringBoot工程的创建、运行与配置
    Javaee基本框架(Struts2,Spring,MyBatista)之间的关系
    XLM解析技术概述
  • 原文地址:https://www.cnblogs.com/springxie/p/1509542.html
Copyright © 2020-2023  润新知