Exemple #1
0
 private void CheckDatas_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     if (CheckDatas.CurrentCell.ColumnIndex < 4)
     {
         CheckDatas.EditMode = DataGridViewEditMode.EditProgrammatically;
         return;
     }
     try
     {
         if (CheckDatas.CurrentCell.RowIndex > -1 && CheckDatas.CurrentCell.ColumnIndex > 3)
         {
             CheckDatas.EditMode = DataGridViewEditMode.EditOnKeystroke;
             Rectangle rect = CheckDatas.GetCellDisplayRectangle(CheckDatas.CurrentCell.ColumnIndex, CheckDatas.CurrentCell.RowIndex, false);
             cmbAdd.Left    = rect.Left;
             cmbAdd.Top     = rect.Top;
             cmbAdd.Width   = rect.Width;
             cmbAdd.Height  = rect.Height;
             cmbAdd.Visible = true;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error");
     }
 }
Exemple #2
0
        private void CheckDatas_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            //frminputdata frmin = new frminputdata();
            //frmin.Redata = this;
            //frmin.Show();

            //combox控件的位置
            if (CheckDatas.CurrentCell.ColumnIndex < 1)
            {
                CheckDatas.EditMode = DataGridViewEditMode.EditProgrammatically;
                return;
            }
            try
            {
                if (CheckDatas.CurrentCell.ColumnIndex > -1 && CheckDatas.CurrentCell.RowIndex > -1)
                {
                    if (CheckDatas.CurrentCell.ColumnIndex == 2)
                    {
                        Rectangle irect = CheckDatas.GetCellDisplayRectangle(CheckDatas.CurrentCell.ColumnIndex, CheckDatas.CurrentCell.RowIndex, false);
                        cmbChkItem.Left    = irect.Left;
                        cmbChkItem.Top     = irect.Top;
                        cmbChkItem.Width   = irect.Width;
                        cmbChkItem.Height  = irect.Height;
                        cmbChkItem.Visible = true;
                    }
                    else if (CheckDatas.CurrentCell.ColumnIndex == 8)
                    {
                        Rectangle srect = CheckDatas.GetCellDisplayRectangle(CheckDatas.CurrentCell.ColumnIndex, CheckDatas.CurrentCell.RowIndex, false);
                        cmbSample.Left    = srect.Left;
                        cmbSample.Top     = srect.Top;
                        cmbSample.Width   = srect.Width;
                        cmbSample.Height  = srect.Height;
                        cmbSample.Visible = true;
                    }
                    else
                    {
                        Rectangle rect = CheckDatas.GetCellDisplayRectangle(CheckDatas.CurrentCell.ColumnIndex, CheckDatas.CurrentCell.RowIndex, false);
                        cmbAdd.Left    = rect.Left;
                        cmbAdd.Top     = rect.Top;
                        cmbAdd.Width   = rect.Width;
                        cmbAdd.Height  = rect.Height;
                        cmbAdd.Visible = true;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
        }
Exemple #3
0
        /// <summary>
        /// DataGridView的单击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void CheckDatas_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (CheckDatas.CurrentCell.ColumnIndex < 1)
            {
                CheckDatas.EditMode = DataGridViewEditMode.EditProgrammatically;
                //cmbSample.Visible = false;
                //cmbChkItem.Visible = false;
                cmbAdd.Visible = false;
                return;
            }
            cmbAdd.Visible = true;
            cmbAdd.Text    = CheckDatas.CurrentCell.Value.ToString();
            Rectangle rect = CheckDatas.GetCellDisplayRectangle(CheckDatas.CurrentCell.ColumnIndex, CheckDatas.CurrentCell.RowIndex, false);

            cmbAdd.Left   = rect.Left;
            cmbAdd.Top    = rect.Top;
            cmbAdd.Width  = rect.Width;
            cmbAdd.Height = rect.Height;
        }
Exemple #4
0
 protected override void CheckDatas_CellClick(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         if (CheckDatas.CurrentCell.ColumnIndex > 8 && CheckDatas.CurrentCell.RowIndex > -1 && CheckDatas.CurrentCell.ColumnIndex < 14)
         {
             if (CheckDatas.CurrentCell.ColumnIndex == 9)//检测单位
             {
                 cmbChkUnit.Text     = CheckDatas.CurrentCell.Value.ToString();
                 CheckDatas.EditMode = DataGridViewEditMode.EditOnKeystroke;
                 Rectangle rect = CheckDatas.GetCellDisplayRectangle(CheckDatas.CurrentCell.ColumnIndex, CheckDatas.CurrentCell.RowIndex, false);
                 cmbChkUnit.Left          = rect.Left;
                 cmbChkUnit.Top           = rect.Top;
                 cmbChkUnit.Width         = rect.Width;
                 cmbChkUnit.Height        = rect.Height;
                 cmbChkUnit.Visible       = true;
                 cmbAdd.Visible           = false;
                 cmbChker.Visible         = false;
                 cmbDetectUnit.Visible    = false;
                 cmbGetSampleAddr.Visible = false;
             }
             else if (CheckDatas.CurrentCell.ColumnIndex == 10)//采样时间
             {
                 cmbAdd.Text         = CheckDatas.CurrentCell.Value.ToString();
                 CheckDatas.EditMode = DataGridViewEditMode.EditOnKeystroke;
                 Rectangle rect = CheckDatas.GetCellDisplayRectangle(CheckDatas.CurrentCell.ColumnIndex, CheckDatas.CurrentCell.RowIndex, false);
                 cmbAdd.Left              = rect.Left;
                 cmbAdd.Top               = rect.Top;
                 cmbAdd.Width             = rect.Width;
                 cmbAdd.Height            = rect.Height;
                 cmbChkUnit.Visible       = false;
                 cmbAdd.Visible           = true;
                 cmbChker.Visible         = false;
                 cmbDetectUnit.Visible    = false;
                 cmbGetSampleAddr.Visible = false;
             }
             else if (CheckDatas.CurrentCell.ColumnIndex == 11)//采样地点
             {
                 cmbGetSampleAddr.Text = CheckDatas.CurrentCell.Value.ToString();
                 CheckDatas.EditMode   = DataGridViewEditMode.EditOnKeystroke;
                 Rectangle rect = CheckDatas.GetCellDisplayRectangle(CheckDatas.CurrentCell.ColumnIndex, CheckDatas.CurrentCell.RowIndex, false);
                 cmbGetSampleAddr.Left    = rect.Left;
                 cmbGetSampleAddr.Top     = rect.Top;
                 cmbGetSampleAddr.Width   = rect.Width;
                 cmbGetSampleAddr.Height  = rect.Height;
                 cmbChkUnit.Visible       = false;
                 cmbChker.Visible         = false;
                 cmbDetectUnit.Visible    = false;
                 cmbGetSampleAddr.Visible = true;
                 cmbAdd.Visible           = false;
             }
             else if (CheckDatas.CurrentCell.ColumnIndex == 12)//被检单位
             {
                 cmbDetectUnit.Text  = CheckDatas.CurrentCell.Value.ToString();
                 CheckDatas.EditMode = DataGridViewEditMode.EditOnKeystroke;
                 Rectangle rect = CheckDatas.GetCellDisplayRectangle(CheckDatas.CurrentCell.ColumnIndex, CheckDatas.CurrentCell.RowIndex, false);
                 cmbDetectUnit.Left       = rect.Left;
                 cmbDetectUnit.Top        = rect.Top;
                 cmbDetectUnit.Width      = rect.Width;
                 cmbDetectUnit.Height     = rect.Height;
                 cmbChkUnit.Visible       = false;
                 cmbChker.Visible         = false;
                 cmbDetectUnit.Visible    = true;
                 cmbGetSampleAddr.Visible = false;
                 cmbAdd.Visible           = false;
             }
             else if (CheckDatas.CurrentCell.ColumnIndex == 13)//检测员
             {
                 cmbChker.Text       = CheckDatas.CurrentCell.Value.ToString();
                 CheckDatas.EditMode = DataGridViewEditMode.EditOnKeystroke;
                 Rectangle rect = CheckDatas.GetCellDisplayRectangle(CheckDatas.CurrentCell.ColumnIndex, CheckDatas.CurrentCell.RowIndex, false);
                 cmbChker.Left            = rect.Left;
                 cmbChker.Top             = rect.Top;
                 cmbChker.Width           = rect.Width;
                 cmbChker.Height          = rect.Height;
                 cmbChkUnit.Visible       = false;
                 cmbChker.Visible         = true;
                 cmbDetectUnit.Visible    = false;
                 cmbGetSampleAddr.Visible = false;
                 cmbAdd.Visible           = false;
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message, "Error");
     }
 }
 private void ucDataUpload_Load(object sender, EventArgs e)
 {
     CheckDatas.SelectAll();
 }
Exemple #6
0
        /// <summary>
        /// datagridview 单击事件
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        protected override void CheckDatas_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            if (CheckDatas.CurrentCell.ColumnIndex < 1)
            {
                CheckDatas.EditMode = DataGridViewEditMode.EditProgrammatically;
                cmbSample.Visible   = false;
                cmbChkItem.Visible  = false;
                cmbAdd.Visible      = false;
                return;
            }
            try
            {
                if (CheckDatas.CurrentCell.ColumnIndex > -1 && CheckDatas.CurrentCell.RowIndex > -1)
                {
                    if (CheckDatas.CurrentCell.ColumnIndex == 2)
                    {
                        cmbAdd.Visible    = false;
                        cmbSample.Visible = false;
                        cmbChkItem.Text   = CheckDatas.CurrentCell.Value.ToString();

                        Rectangle irect = CheckDatas.GetCellDisplayRectangle(CheckDatas.CurrentCell.ColumnIndex, CheckDatas.CurrentCell.RowIndex, false);
                        cmbChkItem.Left    = irect.Left;
                        cmbChkItem.Top     = irect.Top;
                        cmbChkItem.Width   = irect.Width;
                        cmbChkItem.Height  = irect.Height;
                        cmbChkItem.Visible = true;
                    }
                    else if (CheckDatas.CurrentCell.ColumnIndex == 1)
                    {
                        cmbChkItem.Visible = false;
                        cmbAdd.Visible     = false;
                        cmbSample.Text     = CheckDatas.CurrentCell.Value.ToString();

                        Rectangle srect = CheckDatas.GetCellDisplayRectangle(CheckDatas.CurrentCell.ColumnIndex, CheckDatas.CurrentCell.RowIndex, false);
                        cmbSample.Left    = srect.Left;
                        cmbSample.Top     = srect.Top;
                        cmbSample.Width   = srect.Width;
                        cmbSample.Height  = srect.Height;
                        cmbSample.Visible = true;
                    }
                    else if (CheckDatas.CurrentCell.ColumnIndex == 9)//检测单位
                    {
                        cmbChkUnit.Text     = CheckDatas.CurrentCell.Value.ToString();
                        CheckDatas.EditMode = DataGridViewEditMode.EditOnKeystroke;
                        Rectangle rect = CheckDatas.GetCellDisplayRectangle(CheckDatas.CurrentCell.ColumnIndex, CheckDatas.CurrentCell.RowIndex, false);
                        cmbChkUnit.Left          = rect.Left;
                        cmbChkUnit.Top           = rect.Top;
                        cmbChkUnit.Width         = rect.Width;
                        cmbChkUnit.Height        = rect.Height;
                        cmbChkUnit.Visible       = true;
                        cmbAdd.Visible           = false;
                        cmbChker.Visible         = false;
                        cmbDetectUnit.Visible    = false;
                        cmbGetSampleAddr.Visible = false;
                    }
                    else if (CheckDatas.CurrentCell.ColumnIndex == 10)//采样时间
                    {
                        cmbAdd.Text         = CheckDatas.CurrentCell.Value.ToString();
                        CheckDatas.EditMode = DataGridViewEditMode.EditOnKeystroke;
                        Rectangle rect = CheckDatas.GetCellDisplayRectangle(CheckDatas.CurrentCell.ColumnIndex, CheckDatas.CurrentCell.RowIndex, false);
                        cmbAdd.Left              = rect.Left;
                        cmbAdd.Top               = rect.Top;
                        cmbAdd.Width             = rect.Width;
                        cmbAdd.Height            = rect.Height;
                        cmbChkUnit.Visible       = false;
                        cmbAdd.Visible           = true;
                        cmbChker.Visible         = false;
                        cmbDetectUnit.Visible    = false;
                        cmbGetSampleAddr.Visible = false;
                    }
                    else if (CheckDatas.CurrentCell.ColumnIndex == 11)//采样地点
                    {
                        cmbGetSampleAddr.Text = CheckDatas.CurrentCell.Value.ToString();
                        CheckDatas.EditMode   = DataGridViewEditMode.EditOnKeystroke;
                        Rectangle rect = CheckDatas.GetCellDisplayRectangle(CheckDatas.CurrentCell.ColumnIndex, CheckDatas.CurrentCell.RowIndex, false);
                        cmbGetSampleAddr.Left    = rect.Left;
                        cmbGetSampleAddr.Top     = rect.Top;
                        cmbGetSampleAddr.Width   = rect.Width;
                        cmbGetSampleAddr.Height  = rect.Height;
                        cmbChkUnit.Visible       = false;
                        cmbChker.Visible         = false;
                        cmbDetectUnit.Visible    = false;
                        cmbGetSampleAddr.Visible = true;
                        cmbAdd.Visible           = false;
                    }
                    else if (CheckDatas.CurrentCell.ColumnIndex == 12)//被检单位
                    {
                        cmbDetectUnit.Text  = CheckDatas.CurrentCell.Value.ToString();
                        CheckDatas.EditMode = DataGridViewEditMode.EditOnKeystroke;
                        Rectangle rect = CheckDatas.GetCellDisplayRectangle(CheckDatas.CurrentCell.ColumnIndex, CheckDatas.CurrentCell.RowIndex, false);
                        cmbDetectUnit.Left       = rect.Left;
                        cmbDetectUnit.Top        = rect.Top;
                        cmbDetectUnit.Width      = rect.Width;
                        cmbDetectUnit.Height     = rect.Height;
                        cmbChkUnit.Visible       = false;
                        cmbChker.Visible         = false;
                        cmbDetectUnit.Visible    = true;
                        cmbGetSampleAddr.Visible = false;
                        cmbAdd.Visible           = false;
                    }
                    else if (CheckDatas.CurrentCell.ColumnIndex == 13)//检测员
                    {
                        cmbChker.Text       = CheckDatas.CurrentCell.Value.ToString();
                        CheckDatas.EditMode = DataGridViewEditMode.EditOnKeystroke;
                        Rectangle rect = CheckDatas.GetCellDisplayRectangle(CheckDatas.CurrentCell.ColumnIndex, CheckDatas.CurrentCell.RowIndex, false);
                        cmbChker.Left            = rect.Left;
                        cmbChker.Top             = rect.Top;
                        cmbChker.Width           = rect.Width;
                        cmbChker.Height          = rect.Height;
                        cmbChkUnit.Visible       = false;
                        cmbChker.Visible         = true;
                        cmbDetectUnit.Visible    = false;
                        cmbGetSampleAddr.Visible = false;
                        cmbAdd.Visible           = false;
                    }
                    else
                    {
                        cmbSample.Visible        = false;
                        cmbChkItem.Visible       = false;
                        cmbAdd.Visible           = false;
                        cmbChker.Visible         = false;
                        cmbDetectUnit.Visible    = false;
                        cmbGetSampleAddr.Visible = false;
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error");
            }
            //cmbSample.Visible = false;
            //cmbChkItem.Visible = false;
            //cmbAdd.Visible = false;
            //rc = e.RowIndex;
            //col = e.ColumnIndex;
            //if (CheckDatas.CurrentCell.ColumnIndex < 1)
            //{
            //    CheckDatas.EditMode = DataGridViewEditMode.EditProgrammatically;
            //    cmbSample.Visible = false;
            //    cmbChkItem.Visible = false;
            //    cmbAdd.Visible = false;
            //    return;
            //}
            //try
            //{
            //    if (CheckDatas.CurrentCell.ColumnIndex == 1|| CheckDatas.CurrentCell.ColumnIndex == 10 || CheckDatas.CurrentCell.ColumnIndex == 11 || CheckDatas.CurrentCell.ColumnIndex == 12
            //       || CheckDatas.CurrentCell.ColumnIndex == 13 || CheckDatas.CurrentCell.ColumnIndex == 14 || CheckDatas.CurrentCell.ColumnIndex == 15 || CheckDatas.CurrentCell.ColumnIndex == 16)
            //    {
            //        cmbSample.Visible = false;
            //        cmbChkItem.Visible = false;
            //        cmbAdd.Text = CheckDatas.CurrentCell.Value.ToString();

            //        Rectangle rect = CheckDatas.GetCellDisplayRectangle(CheckDatas.CurrentCell.ColumnIndex, CheckDatas.CurrentCell.RowIndex, false);
            //        cmbAdd.Left = rect.Left;
            //        cmbAdd.Top = rect.Top;
            //        cmbAdd.Width = rect.Width;
            //        cmbAdd.Height = rect.Height;
            //        cmbAdd.Visible = true;

            //    }
            //}
            //catch (Exception ex)
            //{
            //    MessageBox.Show(ex.Message, "Error");
            //}
        }