Example #1
0
 private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     AccountOperation addMAccount = new ModifyAccount(e.RowIndex);
     addMAccount.SetDataTable(originalTable);
     addMAccount.ShowDialog();
     FillTheDatagrid();
 }
Example #2
0
        private void dgvCalendar_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            try
            {
                DataGridView dgv = (DataGridView)sender;
                dgv.CurrentCell = dgv.Rows[e.RowIndex].Cells[e.ColumnIndex];

                /*                switch (lang)
                                {
                                    case "calendarfa":
                                        dgvCalendar.CurrentCell = dgvCalendar.Rows[e.RowIndex].Cells[e.ColumnIndex];
                                        break;
                                    case "calendaren":
                                        dgvCalendarEn.CurrentCell = dgvCalendarEn.Rows[e.RowIndex].Cells[e.ColumnIndex];
                                        break;
                                    case "calendarar":
                                        dgvCalendarAr.CurrentCell = dgvCalendarAr.Rows[e.RowIndex].Cells[e.ColumnIndex];
                                        break;
                                    default:
                                        break;
                                }*/
            }
            catch
            {
            }
        }
Example #3
0
 private void dtgProducto_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     _product = (ProductModel)(((List<ProductModel>)dtgProducto.DataSource))[e.RowIndex];
     txtDescripción.Text = _product.Description;
     lstUnidadMedida.SelectedValue = _product.IdUnit;
     checkBox1.Checked = _product.FreeProduct;
 }
Example #4
0
        private void dataGridViewResults_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            GeneSequence seqA = m_sequences[e.ColumnIndex];
            GeneSequence seqB = m_sequences[e.RowIndex];

            String[] results = processor.extractSolution(seqA, seqB);
            String outputMessage = String.Format("Output Console: {0}= MATCH, {1}= SUB, {2}= INDEL",
                processor.MATCH_CHAR, processor.SUB_CHAR, processor.INDEL_CHAR);

            String outputText = String.Format("{0}\r\nGene Alignment for Cell (Row:{1}, Col:{2})\r\nA: {3}\r\n   {4}\r\nB: {5}",
                outputMessage,
                e.RowIndex + 1,
                e.ColumnIndex + 1,
                processor.formatSequence(results[0], MaxToDisplay),
                processor.formatSequence(results[2], MaxToDisplay),
                processor.formatSequence(results[1], MaxToDisplay));

            String sideText = String.Format("\r\n\r\nA: {0}\r\n\r\nB: {1}\r\n\r\nA: {2}\r\n\r\nB: {3}",
                seqA.Name,
                seqB.Name,
                processor.formatSequence(seqA.Sequence, 15),
                processor.formatSequence(seqB.Sequence, 15));

            sideBar.Text = sideText;
            outputConsole.Text = outputText;
        }
Example #5
0
        private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            try
            {
                var dr = dataGridView1.SelectedRows[0];
                Hide();
                var frm = new frmStock();
                frm.Show();
                frm.txtStockID.Text = dr.Cells[0].Value.ToString();
                frm.txtConfigID.Text = dr.Cells[1].Value.ToString();
                frm.txtProductname.Text = dr.Cells[2].Value.ToString();
                frm.txtFeatures.Text = dr.Cells[3].Value.ToString();
                frm.txtPrice.Text = dr.Cells[4].Value.ToString();
                frm.txtQty.Text = dr.Cells[5].Value.ToString();
                frm.txtTotalPrice.Text = dr.Cells[6].Value.ToString();
                frm.dtpStockDate.Text = dr.Cells[7].Value.ToString();
                frm.btnUpdate.Enabled = true;
                frm.btnDelete.Enabled = true;
                frm.btnSave.Enabled = false;
                frm.label8.Text = label1.Text;
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "ล้มเหลว", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
 void GridView_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (e.RowIndex == -1) return;
     if (e.Button == System.Windows.Forms.MouseButtons.Right)
     {
         DataGridView dg = sender as DataGridView;
         foreach (DataGridViewCell cell in dg.Rows[e.RowIndex].Cells)
         {
             if (cell.Selected) {
                 return;
             }
         }
         foreach (DataGridViewRow r in dg.Rows)
         {
             if ((System.Windows.Forms.Control.ModifierKeys & Keys.Shift) != Keys.Shift)
             {
                 r.Selected = false;
             }
             if (r.Index == e.RowIndex)
             {
                 r.Selected = true;
             }
         }
     }
 }
Example #7
0
 protected override void OnMouseClick(swf.DataGridViewCellMouseEventArgs e)
 {
     if (!Handler.MouseClick(e, e.RowIndex))
     {
         base.OnMouseClick(e);
     }
 }
Example #8
0
        private void dtgvTelas_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex >= 0)
            {
                if (dtAtual.Rows.Count > 0) //salva alterações
                {
                    salvaAlteracoes();
                }

                int tela = Convert.ToInt32(dtTelas.Rows[e.RowIndex]["tela_id"]);
                for (int i = 0; i < dtUserCampo.Rows.Count; i++)
                {
                    if (Convert.ToInt32(dtUserCampo.Rows[i]["tela_id"]) == tela)
                    {
                        int campoId = Convert.ToInt32(dtUserCampo.Rows[i]["camp_id"]);
                        bool campAcesso = Convert.ToBoolean(dtUserCampo.Rows[i]["usuariocamp_acesso"]);
                        String campNome = "" + dtUserCampo.Rows[i]["camp_nome"];
                        DataRow linha = dtAtual.NewRow();
                        linha["camp_id"] = campoId;
                        linha["tela_id"] = tela;
                        linha["usuariocamp_acesso"] = campAcesso;
                        linha["camp_nome"] = campNome;
                        dtAtual.Rows.Add(linha);
                    }
                }
            }
        }
Example #9
0
 private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (e.ColumnIndex == 1 && e.RowIndex!= -1)
     {
         (new VisualizarJugador(int.Parse(dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString()))).ShowDialog();
     }
 }
Example #10
0
        public void cellMouseMove(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
        {
            // System.Windows.Forms.DataGridViewRow previousMoveRow;
            if (e.RowIndex < 0)
            {
                return;
            }

            DataGridView DataGridViePerson = sender as DataGridView;

            // DataGridViePerson.Rows[e.RowIndex].Selected =true;

            //鼠标移动到上面拖动代码
            // Person p = DataGridViePerson.Rows[e.RowIndex] as Person;
            if (e.Button == MouseButtons.Left)
            {
                DataGridViePerson.DoDragDrop(DataGridViePerson.Rows[e.RowIndex], DragDropEffects.All);
            }

            // DataGridViePerson.DoDragDrop(p, DragDropEffects.All);
            //鼠标移动拖动结束代码
            if (DataGridViePerson.Rows[e.RowIndex].Selected == true)
            {
                return;
            }
            if (Person.previousMoveRow != null)
            {
                Person.previousMoveRow.DefaultCellStyle.BackColor = System.Drawing.SystemColors.ButtonHighlight;
            }
            Person.previousMoveRow = DataGridViePerson.Rows[e.RowIndex];
            DataGridViePerson.Rows[e.RowIndex].DefaultCellStyle.BackColor = System.Drawing.Color.Aquamarine;
            //变色结束
        }
Example #11
0
 private void DataGridView1_RowHeaderMouseClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
 {
     try {
         DataGridViewRow dr = DataGridView1.SelectedRows[0];
         this.Hide();
         My.MyProject.Forms.frmBookReturn.Show();
         My.MyProject.Forms.frmBookReturn.txtReturnID1.Text      = dr.Cells[0].Value.ToString();
         My.MyProject.Forms.frmBookReturn.dtpReturnDate1.Text    = dr.Cells[1].Value.ToString();
         My.MyProject.Forms.frmBookReturn.txtFine1.Text          = dr.Cells[2].Value.ToString();
         My.MyProject.Forms.frmBookReturn.txtTransactionID1.Text = dr.Cells[3].Value.ToString();
         My.MyProject.Forms.frmBookReturn.dtpIssueDate1.Text     = dr.Cells[4].Value.ToString();
         My.MyProject.Forms.frmBookReturn.dtpDueDate1.Text       = dr.Cells[5].Value.ToString();
         My.MyProject.Forms.frmBookReturn.txtAccessionNo1.Text   = dr.Cells[6].Value.ToString();
         My.MyProject.Forms.frmBookReturn.TextBox2.Text          = dr.Cells[6].Value.ToString();
         My.MyProject.Forms.frmBookReturn.txtBookTitle1.Text     = dr.Cells[7].Value.ToString();
         My.MyProject.Forms.frmBookReturn.txtAuthor1.Text        = dr.Cells[8].Value.ToString();
         My.MyProject.Forms.frmBookReturn.txtCategory1.Text      = dr.Cells[9].Value.ToString();
         My.MyProject.Forms.frmBookReturn.txtISBN1.Text          = dr.Cells[10].Value.ToString();
         My.MyProject.Forms.frmBookReturn.txtEdition1.Text       = dr.Cells[11].Value.ToString();
         My.MyProject.Forms.frmBookReturn.txtStaffID.Text        = dr.Cells[12].Value.ToString();
         My.MyProject.Forms.frmBookReturn.txtStaffName.Text      = dr.Cells[13].Value.ToString();
         My.MyProject.Forms.frmBookReturn.txtDepartment1.Text    = dr.Cells[14].Value.ToString();
         My.MyProject.Forms.frmBookReturn.btnUpdate1.Enabled     = true;
         My.MyProject.Forms.frmBookReturn.btnDelete1.Enabled     = true;
         My.MyProject.Forms.frmBookReturn.btnSave1.Enabled       = false;
     } catch (Exception ex) {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #12
0
 void DataGridView_2xls_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         if ((e.RowIndex == -1) && (e.ColumnIndex == -1))
         {
             if (MessageBox.Show(lngRPM.s_SaveSelectedRowsToExcelFile.s, "?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
             {
                 Excell excell = new Excell();
                 string FileName = "Table";
                 excell.Export(ref FileName, this);
             }
         }
         else
         {
             if (e.ColumnIndex == -1)
             {
                 if (MessageBox.Show(lngRPM.s_ShowRowNumbers.s + "?", "?", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.Yes)
                 {
                     if (!DataGridViewWithRowNumber)
                     {
                         DataGridViewWithRowNumber = true;
                     }
                 }
                 else
                 {
                     if (DataGridViewWithRowNumber)
                     {
                         DataGridViewWithRowNumber = false;
                     }
                 }
             }
         }
     }
 }
Example #13
0
 private void dataGridView2_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
 {            
     if (dataGridView2.SelectedRows.Count > 0)
     {
         DataGridViewRow row = dataGridView2.SelectedRows[0];
         _inventoryModelTemp = (InventoryModel)row.DataBoundItem;
         if (!string.IsNullOrEmpty(txtDesde.Text) && !string.IsNullOrEmpty(txtHasta.Text))
         {
             DateTime initDate;
             DateTime endDate;
             if (DateTime.TryParse(txtDesde.Text, out initDate) && DateTime.TryParse(txtHasta.Text, out endDate))
             {
                 dataGridView1.DataSource = _inventory.GetInventoryDetail(_inventoryModelTemp.IdProduct, initDate, endDate, lstTipoMovimiento.SelectedValue.ToString());
             }
             else
             {
                 dataGridView1.DataSource = _inventory.GetInventoryDetail(_inventoryModelTemp.IdProduct);
             }
         }
         else
         {
             dataGridView1.DataSource = _inventory.GetInventoryDetail(_inventoryModelTemp.IdProduct);
         }                
     }
 }
Example #14
0
 private void CaptureGridCellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (e.ColumnIndex == 0 && captureGrid.SelectedRows.OfType<DataGridViewRow>().Any(x => x.Index == e.RowIndex))
     {
         ToggleSelected();
     }
 }
 void out方法_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (e.RowIndex < 0)
     {
         return;
     }
     var __名称 = (string)this.out值[0, e.RowIndex].Value;
     var __元数据 = _事件.形参列表[e.RowIndex].元数据;
     var __单元格 = this.out值[_值所在列索引, e.RowIndex];
     var __值 = __单元格.Value == null ? "" : __单元格.Value.ToString();
     switch (__元数据.结构)
     {
         case E数据结构.点:
             break;
         case E数据结构.行:
             var __行窗口 = new F行结构_查看(__元数据.子成员列表, "{}", __名称);
             __行窗口.ShowDialog();
             break;
         case E数据结构.列:
             var __列窗口 = new F列结构_查看(__元数据, "[]", __名称);
             __列窗口.ShowDialog();
             break;
         case E数据结构.表:
             var __表格窗口 = new F表格结构_查看(__元数据.子成员列表, "[{}]", __名称);
             __表格窗口.ShowDialog();
             break;
         default:
             throw new ArgumentOutOfRangeException();
     }
 }
Example #16
0
 private void dg_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (dg.SelectedRows.Count > 0)
     {
         dg.SelectedRows[0].Selected = false;
     }
 }
Example #17
0
 private void dataGridView1_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     pictureBox5.Enabled = true;
     pictureBox4.Enabled = false;
     textBox3.Text = "";
     textBox4.Text = "";
     textBox5.Text = "";
     textBox6.Text = "";
     textBox7.Text = "";
     textBox8.Text = "";
     comboBox2.Text = "";
     id = dataGridView1.Rows[e.RowIndex].Cells[0].Value.ToString();
     textBox3.Text = dataGridView1.Rows[e.RowIndex].Cells[1].Value.ToString();
     textBox4.Text = dataGridView1.Rows[e.RowIndex].Cells[2].Value.ToString();
     textBox5.Text = dataGridView1.Rows[e.RowIndex].Cells[3].Value.ToString();
     textBox6.Text = dataGridView1.Rows[e.RowIndex].Cells[4].Value.ToString();
     textBox7.Text = dataGridView1.Rows[e.RowIndex].Cells[5].Value.ToString();
     textBox8.Text = dataGridView1.Rows[e.RowIndex].Cells[6].Value.ToString();
     string dt = dataGridView1.Rows[e.RowIndex].Cells[7].Value.ToString();
     if (dt == "True")
     {
         comboBox2.Text = "Ativo";
     }
     else
     {
         comboBox2.Text = "Inativo";
     }
 }
 private void DataGridView1_RowHeaderMouseClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
 {
     try {
         DataGridViewRow dr = DataGridView1.SelectedRows[0];
         this.Hide();
         My.MyProject.Forms.frmBookIssue.Show();
         My.MyProject.Forms.frmBookIssue.txtTransactionID.Text    = dr.Cells[0].Value.ToString();
         My.MyProject.Forms.frmBookIssue.dtpIssueDate.Text        = dr.Cells[1].Value.ToString();
         My.MyProject.Forms.frmBookIssue.dtpDueDate.Text          = dr.Cells[2].Value.ToString();
         My.MyProject.Forms.frmBookIssue.cmbAccessionNo.Text      = dr.Cells[3].Value.ToString();
         My.MyProject.Forms.frmBookIssue.TextBox1.Text            = dr.Cells[3].Value.ToString();
         My.MyProject.Forms.frmBookIssue.txtBookTitle.Text        = dr.Cells[4].Value.ToString();
         My.MyProject.Forms.frmBookIssue.txtAuthor.Text           = dr.Cells[5].Value.ToString();
         My.MyProject.Forms.frmBookIssue.txtCategory.Text         = dr.Cells[6].Value.ToString();
         My.MyProject.Forms.frmBookIssue.txtISBN.Text             = dr.Cells[7].Value.ToString();
         My.MyProject.Forms.frmBookIssue.txtEdition.Text          = dr.Cells[8].Value.ToString();
         My.MyProject.Forms.frmBookIssue.cmbStudentID.Text        = dr.Cells[9].Value.ToString();
         My.MyProject.Forms.frmBookIssue.txtStudentName.Text      = dr.Cells[10].Value.ToString();
         My.MyProject.Forms.frmBookIssue.txtCourse.Text           = dr.Cells[11].Value.ToString();
         My.MyProject.Forms.frmBookIssue.txtDepartment.Text       = dr.Cells[12].Value.ToString();
         My.MyProject.Forms.frmBookIssue.txtStatus.Text           = dr.Cells[13].Value.ToString();
         My.MyProject.Forms.frmBookIssue.btnUpdate_record.Enabled = true;
         My.MyProject.Forms.frmBookIssue.btnDelete.Enabled        = true;
         My.MyProject.Forms.frmBookIssue.btnSave.Enabled          = false;
     } catch (Exception ex) {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #19
0
 public void gridStations_CellMouseClick(System.Object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
 {
     showSelectedStationCounters();
     //Dim stationID As Long = CInt(gridStations.Rows(e.RowIndex).Cells(tCol_ID).Value)
     //labStationCounters.Text = "Station Counters: " & gridStations.Rows(e.RowIndex).Cells(tCol_StationName).Value
     //showCounters(stationID)
 }
Example #20
0
        private void datagridview1_CellMouseClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
        {
            DataGridView view = (DataGridView)sender;

            if (e.Button == MouseButtons.Right)
            {
                if (e.RowIndex < 0)
                {
                    return;
                }
                view.Rows[e.RowIndex].Selected = true;
                if (null != view.Rows[e.RowIndex].Cells[0].Value)
                {
                    string path = view.Rows[e.RowIndex].Cells[1].Value.ToString();
                    System.Drawing.Rectangle r = view.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, true);
                    curRClickPath = path;
                    MenuItem DelMenu = new MenuItem("複製");
                    DelMenu.Click += new System.EventHandler(this.mi_romenuclick);
                    List <MenuItem> menuItems = new List <MenuItem>()
                    {
                        DelMenu
                    };
                    ContextMenu buttonMenu = new ContextMenu(menuItems.ToArray());
                    buttonMenu.Show((Control)sender, (new System.Drawing.Point(r.Left + e.X, r.Top + e.Y)), LeftRightAlignment.Left);
                }
            }
        }
Example #21
0
 private void DataGridView1_RowHeaderMouseClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
 {
     try {
         DataGridViewRow dr = DataGridView1.SelectedRows[0];
         this.Hide();
         My.MyProject.Forms.frmNewsPaper.Show();
         // or simply use column name instead of index
         //dr.Cells["id"].Value.ToString();
         My.MyProject.Forms.frmNewsPaper.txtID.Text        = dr.Cells[0].Value.ToString();
         My.MyProject.Forms.frmNewsPaper.txtPaperName.Text = dr.Cells[1].Value.ToString();
         My.MyProject.Forms.frmNewsPaper.dtpDate.Text      = dr.Cells[2].Value.ToString();
         if ((dr.Cells[3].Value.ToString() == "P"))
         {
             My.MyProject.Forms.frmNewsPaper.RadioButton1.Checked = true;
         }
         if ((dr.Cells[3].Value.ToString() == "A"))
         {
             My.MyProject.Forms.frmNewsPaper.RadioButton2.Checked = true;
         }
         My.MyProject.Forms.frmNewsPaper.txtRemarks.Text          = dr.Cells[4].Value.ToString();
         My.MyProject.Forms.frmNewsPaper.btnUpdate_record.Enabled = true;
         My.MyProject.Forms.frmNewsPaper.btnDelete.Enabled        = true;
         My.MyProject.Forms.frmNewsPaper.btnSave.Enabled          = false;
     } catch (Exception ex) {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #22
0
        //щелчок по гриду - получение координат выбранной ячейки и перенос данных в поля
        private void dataGridView_Clients_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.RowIndex != -1 && e.ColumnIndex != -1)
            {
                if (e.Button == MouseButtons.Left)
                {
                    int row = e.RowIndex;
                    int column = e.ColumnIndex;
                    DataGridViewCell clickedCell = (sender as DataGridView).Rows[row].Cells[column];
                    dataGridView_Clients.Rows[row].Selected = true;
                    label_id.Text = ((int)dataGridView_Clients["id", row].Value).ToString();

                    textBox_Surname.Text = (string)dataGridView_Clients["surname", row].Value;
                    textBox_Name.Text = (string)dataGridView_Clients["name", row].Value;
                    textBox_Patronymic.Text = (string)dataGridView_Clients["patronymic", row].Value;
                    textBox_Birthdate.Text = ((DateTime)dataGridView_Clients["birthdate", row].Value).ToShortDateString();
                    textBox_Phone.Text = (string)dataGridView_Clients["phone", row].Value;
                    textBox_Email.Text = (string)dataGridView_Clients["email", row].Value;
                    textBox_Address.Text = (string)dataGridView_Clients["address", row].Value;
                    textBox_Passport_series.Text = (string)dataGridView_Clients["passport_series", row].Value;
                    textBox_Passport_number.Text = (string)dataGridView_Clients["passport_number", row].Value;
                    textBox_Issue_date.Text = ((DateTime)dataGridView_Clients["issue_date", row].Value).ToShortDateString();
                    textBox_Issue_department.Text = (string)dataGridView_Clients["issue_department", row].Value;
                }
            }
        }
Example #23
0
 private void CaptureGridCellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (e.ColumnIndex == 0 && e.RowIndex > -1)
     {
         captureGrid.EndEdit();
     }
 }
        private void dgvTipoArreglos_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (modo.Equals("crud"))
            {
                dgvTipoArreglos.ContextMenuStrip = menuCrud;
                try
                {
                    if (e.Button == MouseButtons.Right)
                    {
                        // Add this
                        dgvTipoArreglos.CurrentCell = dgvTipoArreglos.Rows[e.RowIndex].Cells[e.ColumnIndex];
                        // Can leave these here - doesn't hurt
                        dgvTipoArreglos.Rows[e.RowIndex].Selected = true;
                        dgvTipoArreglos.Focus();
                    }
                }
                catch (Exception Ex)
                {

                    dgvTipoArreglos.ContextMenuStrip = null;
                }
            }
            else
            {

            }
           
        }
Example #25
0
        /// <summary>
        /// Confirms the stairs location & places it permanently
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        public void ConfirmPlaceStairs(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                StopPlacing();
                return;
            }
            else if (!allowedLocation)
            {
                MessageBox.Show("You can't place stairs here.", "Not allowed", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                return;
            }

            // Remove remove handlers
            StopPlacing();

            // Only trigger when stairs should be placed
            if (stairsDirection == 0) return;
            stairsDirection = 0;

            // Set stairs location
            int next = 5; // Count down from 5 to 2
            for (int i = 0; i < 4; i++)
            {
                Cell.SetValue(next, newLocation[i, 1], newLocation[i, 0]);

                // Add top of stairs to next level
                if (i < 3 && App.activeGrid + 1 < App.GetLevelCount())
                    Cell.SetValue(6, newLocation[i, 1], newLocation[i, 0], App.activeGrid + 1);

                next--;
            }
        }
 protected void OnRowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     Guid ID = Guid.Parse(FlightGridView.Rows[e.RowIndex].Cells["ID"].Value.ToString());
     if(idSelectionCallBack!=null)
         this.idSelectionCallBack(ID);
     this.Close();
 }
Example #27
0
 private void dataGridView_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     for (int i = 0;i < dataGridView.RowCount; i++)
     {
         dataGridView.Rows[i].HeaderCell.Value = (i+1).ToString();
     }
 }
        public void dataGridView_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
        {
            if (e.Button == MouseButtons.Right)
            {
                try
                {

                    c = (sender as DataGridView)[e.ColumnIndex, e.RowIndex];
                    if (!c.Selected)
                    {
                        c.DataGridView.ClearSelection();
                        c.DataGridView.CurrentCell = c;
                        c.Selected = true;
                    }
                    string add_line;
                    if (c.Value.ToString() != "")
                    {
                        add_line = c.Value.ToString();
                    }
                    else
                    {
                        add_line = "Пустые";
                    }
                    c.DataGridView.ContextMenuStrip.Items["ContainsMenuItem"].Text = String.Format("Cодержит \"{0}\"", add_line);
                    c.DataGridView.ContextMenuStrip.Items["NotContainsMenuItem"].Text = String.Format("Не содержит \"{0}\"", add_line);
                    c.DataGridView.ContextMenuStrip.Items["EqualsMenuItem"].Text = String.Format("Равно \"{0}\"", add_line);
                    c.DataGridView.ContextMenuStrip.Items["NotEqualsMenuItem"].Text = String.Format("Не равно \"{0}\"", add_line);
                    c.DataGridView.ContextMenuStrip.Items["ClearFilterMenuItem"].Text = String.Format("Снять фильтр с \"{0}\"", c.OwningColumn.HeaderText);

                }
                catch { }
            }
        }
Example #29
0
 private void DataGridView1_RowHeaderMouseClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
 {
     try {
         DataGridViewRow dr = DataGridView1.SelectedRows[0];
         this.Hide();
         My.MyProject.Forms.frmStaff.Show();
         My.MyProject.Forms.frmStaff.txtStaffID.Text   = dr.Cells[0].Value.ToString();
         My.MyProject.Forms.frmStaff.txtStaffName.Text = dr.Cells[1].Value.ToString();
         if ((dr.Cells[2].Value.ToString() == "Male"))
         {
             My.MyProject.Forms.frmStaff.rbMale.Checked = true;
         }
         if ((dr.Cells[2].Value.ToString() == "Female"))
         {
             My.MyProject.Forms.frmStaff.rbFemale.Checked = true;
         }
         My.MyProject.Forms.frmStaff.txtFatherName.Text       = dr.Cells[3].Value.ToString();
         My.MyProject.Forms.frmStaff.dtpDateOfJoining.Text    = dr.Cells[4].Value.ToString();
         My.MyProject.Forms.frmStaff.cmbDepartment.Text       = dr.Cells[5].Value.ToString();
         My.MyProject.Forms.frmStaff.txtTempAddress.Text      = dr.Cells[6].Value.ToString();
         My.MyProject.Forms.frmStaff.txtPermanentAddress.Text = dr.Cells[7].Value.ToString();
         My.MyProject.Forms.frmStaff.dtpDOB.Text      = dr.Cells[8].Value.ToString();
         My.MyProject.Forms.frmStaff.txtPhoneNo.Text  = dr.Cells[9].Value.ToString();
         My.MyProject.Forms.frmStaff.txtMobileNo.Text = dr.Cells[10].Value.ToString();
         My.MyProject.Forms.frmStaff.txtEmail.Text    = dr.Cells[11].Value.ToString();
         byte[]       data = (byte[])dr.Cells[12].Value;
         MemoryStream ms   = new MemoryStream(data);
         My.MyProject.Forms.frmStaff.Picture.Image            = Image.FromStream(ms);
         My.MyProject.Forms.frmStaff.btnUpdate_record.Enabled = true;
         My.MyProject.Forms.frmStaff.btnDelete.Enabled        = true;
         My.MyProject.Forms.frmStaff.btnSave.Enabled          = false;
     } catch (Exception ex) {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #30
0
        private void dataGridView1_RowHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            try
            {
                var dr = dataGridView1.SelectedRows[0];
                Hide();
                var frm = new frmCustomers();
                frm.Show();
                frm.txtCustomerID.Text = dr.Cells[0].Value.ToString();
                frm.txtCustomerName.Text = dr.Cells[1].Value.ToString();
                frm.txtAddress.Text = dr.Cells[2].Value.ToString();
                frm.txtCity.Text = dr.Cells[4].Value.ToString();
                frm.txtLandmark.Text = dr.Cells[3].Value.ToString();
                frm.cmbState.Text = dr.Cells[5].Value.ToString();
                frm.txtZipCode.Text = dr.Cells[6].Value.ToString();
                frm.txtPhone.Text = dr.Cells[7].Value.ToString();
                frm.txtEmail.Text = dr.Cells[8].Value.ToString();
                frm.txtMobileNo.Text = dr.Cells[9].Value.ToString();
                frm.txtFaxNo.Text = dr.Cells[10].Value.ToString();
                frm.txtNotes.Text = dr.Cells[11].Value.ToString();
                frm.btnUpdate.Enabled = true;
                frm.btnDelete.Enabled = true;
                frm.btnSave.Enabled = false;
                frm.txtCustomerName.Focus();
            }

            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "ล้มเหลว", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #31
0
        private void dgMercaderia_CellMouseClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
        {
            EjecutarAsync(async() =>
            {
                if (e.RowIndex < 0)
                {
                    return;
                }

                MercaderiaListadoItem mercaderiaListadoItem = (MercaderiaListadoItem)dgMercaderia.CurrentRow.DataBoundItem;
                if (dgMercaderia.Columns[e.ColumnIndex].Name == "Editar")
                {
                    await mercaderiaListadoViewModel.ModificarAsync(mercaderiaListadoItem);
                    await mercaderiaListadoViewModel.BuscarAsync();
                }
                if (dgMercaderia.Columns[e.ColumnIndex].Name == "Eliminar")
                {
                    if (DialogResult.Yes == CustomMessageBox.ShowDialog(Resources.eliminarElemento, this.Text, MessageBoxButtons.YesNo, CustomMessageBoxIcon.Info))
                    {
                        await mercaderiaListadoViewModel.BorrarAsync(mercaderiaListadoItem);
                        await mercaderiaListadoViewModel.BuscarAsync();
                        await actualizarMercaderiaARecibirAsync();
                    }
                }
            });
        }
Example #32
0
        protected override void OnCellMouseUp(DataGridViewCellMouseEventArgs e)
        {
            base.OnCellMouseUp(e);

            if (e.Button == MouseButtons.Right)
                this.menuRemove.Show(this, e.Location);
        }
        private void SortColumn(object sender, DataGridViewCellMouseEventArgs e)
        {
            var columnName = Control.GridView.Columns[e.ColumnIndex].Name;
            if (columnName == "Icon") { columnName = "Severity"; }

            Control.InspectionResults = new BindingList<CodeInspectionResultGridViewItem>(_gridViewSort.Sort(Control.InspectionResults.AsEnumerable(), columnName).ToList());
        }
Example #34
0
 private void dgAttendee_CellMouseDown(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         dgAttendee.CurrentCell = dgAttendee[e.ColumnIndex, e.RowIndex];
     }
 }
 private void dgvMilitaries_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     PropertyComparer comparer = new PropertyComparer(this.dgvMilitaries.Columns[e.ColumnIndex].DataPropertyName, this.dgvMilitaries.Columns[e.ColumnIndex].DefaultCellStyle.Alignment == DataGridViewContentAlignment.MiddleRight, this.smalltobig);
     this.Militaries.Sort(comparer);
     this.RebindDataSource();
     this.smalltobig = !this.smalltobig;
 }
Example #36
0
        private void dataGridViewMaker_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            try
            {
                selectIndex = e.RowIndex;
              //  selectRow = dataGridViewMaker.Rows[selectIndex].Cells[2].Value.ToString();
                selectIdBrand = int.Parse(dataGridViewMaker.Rows[selectIndex].Cells[1].Value.ToString());

                using (CsvReader csv = new CsvReader(new StreamReader(filePathMoels), true, ';'))
                {
                    int i = 0;
                    dataGridViewModel.Rows.Clear();
                    while (csv.ReadNextRecord())
                    {
                        if (int.Parse(csv[1]) == selectIdBrand)
                        {
                            dataGridViewModel.Rows.Add();
                            dataGridViewModel.Rows[i].Cells[0].Value = i + 1;
                            dataGridViewModel.Rows[i].Cells[1].Value = csv[0];
                            dataGridViewModel.Rows[i].Cells[2].Value = csv[2];
                            i++;
                        }
                    }
                }
            }
            catch
            {

            }
        }
Example #37
0
 private void dataGridView1_CellMouseClick(object sender, DataGridViewCellMouseEventArgs e)
 {
     if (e.Button == MouseButtons.Left)
     {
         dataGridView1.ReadOnly = true;
     }
 }
Example #38
0
 private void dgvBook_CellMouseUp(object sender, DataGridViewCellMouseEventArgs e)
 {
     DataGridView view = (DataGridView)sender;
     if (e.Button != MouseButtons.Right || e.RowIndex < 0) return;
     view.ClearSelection();
     view.Rows[e.RowIndex].Selected = true;
 }
        private void Data_Os_CellMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            int IdOs = int.Parse(Data_Os.CurrentRow.Cells[0].Value.ToString());
            Frm_EditarOS frm_Editaros = new Frm_EditarOS(v_IdTecnico, IdOs);

            frm_Editaros.ShowDialog();
        }
Example #40
0
 protected override void OnMouseClick(System.Windows.Forms.DataGridViewCellMouseEventArgs e)
 {
     if (new Rectangle(l, s).Contains(e.Location))
     {
         isChecked = !isChecked;
     }
     base.OnMouseClick(e);
 }
Example #41
0
 private void dgUsuario_CellMouseDoubleClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
 {
     EjecutarAsync(async() =>
     {
         Modelo.Usuario usuario = (Modelo.Usuario)dgUsuario.CurrentRow.DataBoundItem;
         await usuarioListadoViewModel.ModificarAsync(usuario);
     });
 }
Example #42
0
 private void OnColumnHeaderMouseClick(object sender,
                                       SWF.DataGridViewCellMouseEventArgs args)
 {
     if (args.Button == SWF.MouseButtons.Left &&
         args.ColumnIndex == provider.Column.Index)
     {
         RaiseAutomationEvent();
     }
 }
Example #43
0
        void recListCell_MouseDown(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
        {
//			util.debugWriteLine(e);
            if (e.Button == System.Windows.Forms.MouseButtons.Right &&
                e.ColumnIndex > -1 && e.RowIndex > -1)
            {
                recList.CurrentCell = recList[e.ColumnIndex, e.RowIndex];
            }
        }
Example #44
0
 private void DataGridView1_RowHeaderMouseClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
 {
     try {
         DataGridViewRow dr = DataGridView1.SelectedRows[0];
         txtCourseName.Text       = dr.Cells[0].Value.ToString();
         TextBox1.Text            = dr.Cells[0].Value.ToString();
         btnUpdate_record.Enabled = true;
         btnDelete.Enabled        = true;
         btnSave.Enabled          = false;
     } catch (Exception ex) {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #45
0
 private void dgvReservas_RowHeaderMouseClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
 {
     try
     {
         ID           = Convert.ToInt32(dgvReservas.Rows[e.RowIndex].Cells[0].Value.ToString());
         lblInfo.Text = "";
     }
     catch
     {
         ID           = 0;
         lblInfo.Text = "Clique em um registro para iniciar o processo de Devolução!";
     }
 }
 private void dgv_thematicOrder_CellMouseDown(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
 {
     try
     {
         if (e.Button == MouseButtons.Right)
         {
             if (e.RowIndex >= 0)
             {
                 //若行已是选中状态就不再进行设置
                 if (dgv_CommonOrder.Rows[e.RowIndex].Selected == false)
                 {
                     dgv_CommonOrder.ClearSelection();
                     dgv_CommonOrder.Rows[e.RowIndex].Selected = true;
                 }
                 //只选中一行时设置活动单元格
                 if (dgv_CommonOrder.SelectedRows.Count == 1)
                 {
                     dgv_CommonOrder.CurrentCell = dgv_CommonOrder.Rows[e.RowIndex].Cells[e.ColumnIndex];
                 }
                 //弹出操作菜单
                 cms_rightButton.Show(MousePosition.X, MousePosition.Y);
             }
         }
         else if (e.Button == MouseButtons.Left)
         {
             if (e.RowIndex >= 0)
             {
                 //若行已是选中状态就不再进行设置
                 if (dgv_CommonOrder.Rows[e.RowIndex].Selected == false)
                 {
                     dgv_CommonOrder.ClearSelection();
                     dgv_CommonOrder.Rows[e.RowIndex].Selected = true;
                 }
                 //只选中一行时设置活动单元格
                 if (dgv_CommonOrder.SelectedRows.Count == 1)
                 {
                     dgv_CommonOrder.CurrentCell = dgv_CommonOrder.Rows[e.RowIndex].Cells[e.ColumnIndex];
                 }
                 //弹出操作菜单
                 //cms_rightButton.Show(MousePosition.X, MousePosition.Y);
                 DataGridViewRow dgvr = dgv_CommonOrder.SelectedRows[0];
                 CommonOrder co = (CommonOrder)dgvr.DataBoundItem;
                 this.topForm.ShowSelectedOrderInMap(co.Orderid,null);
             }
         }
     }
     catch (System.ArgumentOutOfRangeException e1)
     {
         //e1.ToString();
     }
 }
Example #47
0
 private void dgvDSLoaiDeThi_CellMouseClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
 {
     try
     {
         DataGridViewRow row = new DataGridViewRow();
         row = dgvDSLoaiDeThi.Rows[e.RowIndex];
         txtTenLoaiDeThi.Text = row.Cells[1].Value.ToString();
         txtThoiLuong.Text    = row.Cells[2].Value.ToString();
     }
     catch
     {
         return;
     }
 }
 protected override void OnCellMouseClick(System.Windows.Forms.DataGridViewCellMouseEventArgs e)
 {
     if (e.Clicks == 1)
     {
         // Had to do this with a variable as using a MessageBox
         // here would block us from pulling off a double click
         test = "1 click ";
         base.OnCellMouseClick(e);
     }
     else
     {
         MessageBox.Show("OnCellMouseClick");
     }
 }
Example #49
0
 private void ExtensionTableGrid_CellMouseClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
 {
     try
     {
         if (Double.IsNaN(((double[])DATATABLE[e.ColumnIndex])[e.RowIndex]))
         {
             String text = FITSBINTABLE.GetTTypeEntryRow(ExtensionTableGrid.Columns[e.ColumnIndex].HeaderText, e.RowIndex);
             Clipboard.SetText(text);
             MessageBox.Show(text + "\r\r" + "copied to clipboard", ExtensionTableGrid.Columns[e.ColumnIndex].HeaderText);
         }
     }
     catch
     {
     }
 }
Example #50
0
 private void DataGridView1_RowHeaderMouseClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
 {
     try {
         DataGridViewRow dr = DataGridView1.SelectedRows[0];
         this.Hide();
         My.MyProject.Forms.frmBookIssue.Show();
         // or simply use column name instead of index
         //dr.Cells["id"].Value.ToString();
         My.MyProject.Forms.frmBookIssue.cmbStaffID.Text     = dr.Cells[0].Value.ToString();
         My.MyProject.Forms.frmBookIssue.txtStaffName.Text   = dr.Cells[1].Value.ToString();
         My.MyProject.Forms.frmBookIssue.txtDepartment1.Text = dr.Cells[5].Value.ToString();
     } catch (Exception ex) {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #51
0
        private void datagridview1_CellMouseDbClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
        {
            DataGridView view = (DataGridView)sender;

            if (e.Button == MouseButtons.Left)
            {
                if (e.RowIndex < 0)
                {
                    return;
                }
                view.Rows[e.RowIndex].Selected = true;
                if (null != view.Rows[e.RowIndex].Cells[0].Value)
                {
                    string path = view.Rows[e.RowIndex].Cells[1].Value.ToString();
                    System.Diagnostics.Process.Start("explorer.exe", string.Format("/select,\"{0}\"", view.Rows[e.RowIndex].Cells[1].Value.ToString()));
                }
            }
        }
Example #52
0
        private void dgProveedor_CellMouseClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
        {
            EjecutarAsync(async() =>
            {
                Proveedor proveedor = (Proveedor)dgProveedor.CurrentRow.DataBoundItem;

                if (dgProveedor.Columns[e.ColumnIndex].Name == "Editar")
                {
                    await proveedorListadoViewModel.ModificarAsync(proveedor);
                }
                if (dgProveedor.Columns[e.ColumnIndex].Name == "Eliminar")
                {
                    if (DialogResult.Yes == CustomMessageBox.ShowDialog(Resources.eliminarElemento, this.Text, MessageBoxButtons.YesNo, CustomMessageBoxIcon.Info))
                    {
                        await proveedorListadoViewModel.BorrarAsync(proveedor);
                    }
                }
            });
        }
Example #53
0
 protected override void OnMouseClick(swf.DataGridViewCellMouseEventArgs e)
 {
     if (!Handler.MouseClick(e, e.RowIndex))
     {
         if (DataGridView == null)
         {
             return;
         }
         var currentCellAddress = DataGridView.CurrentCellAddress;
         if (currentCellAddress.X == e.ColumnIndex && currentCellAddress.Y == e.RowIndex && e.Button == swf.MouseButtons.Left)
         {
             if (DataGridView.EditMode != swf.DataGridViewEditMode.EditProgrammatically)
             {
                 DataGridView.BeginEdit(true);
             }
         }
         base.OnMouseClick(e);
     }
 }
Example #54
0
        private void dgProductos_CellMouseClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
        {
            Ejecutar(() =>
            {
                if (e.RowIndex < 0)
                {
                    return;
                }

                VentaBotoneraItem ventaBotoneraItem = (VentaBotoneraItem)dgProductos.CurrentRow.DataBoundItem;
                if (dgProductos.Columns[e.ColumnIndex].Name == "Eliminar")
                {
                    if (DialogResult.Yes == CustomMessageBox.ShowDialog(Resources.quitarElemento, this.Text, MessageBoxButtons.YesNo, CustomMessageBoxIcon.Info))
                    {
                        ventaBotoneraViewModel.Quitar(ventaBotoneraItem);
                    }
                }
            });
        }
        private void dgvLookup_ColumnHeaderMouseClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
        {
            xColumn         = e.ColumnIndex;
            Lbl_Lookup.Text = Lbl_Lookup.Tag + dgvLookup.Columns[xColumn].HeaderText.ToString().Trim();

            int xRowCount = dgvLookup.RowCount;

            try
            {
                //-- Asignando ancho fijo a celdas y deshabilitando campo --
                for (int yRowCount = 0; yRowCount <= xRowCount - 1; yRowCount++)
                {
                    dgvLookup.Rows[yRowCount].Height = 30;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Microsoft Dynamics GP", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void dataGridView1_RowHeaderMouseClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
        {
            IQueryFilter pQuery = new QueryFilterClass();

            //读取表中左第一列列名和当前选中行做第一列字段名
            string col = this.dataGridView1.Columns[0].Name;
            string val = this.dataGridView1.CurrentCell.OwningRow.Cells[0].Value.ToString();

            //设置高亮要素的查询条件

            pQuery.WhereClause = col + "=" + val;
            //a.layer是我当前TOCControl控件中选中的图层
            IFeatureLayer     pFeatureLayer  = pLayer as IFeatureLayer;
            IFeatureSelection pFeatSelection = pFeatureLayer as IFeatureSelection;


            //查询出被选中Features要素
            pFeatSelection.SelectFeatures(pQuery, esriSelectionResultEnum.esriSelectionResultNew, false);
            // 刷新
            a.ActiveView.PartialRefresh(esriViewDrawPhase.esriViewGeoSelection, null, null);
        }
Example #57
0
        private void dataGridView1_CellMouseClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
        {
            if (e.Button != MouseButtons.Right)
            {
                return;
            }

            if (e.RowIndex < 0 || e.ColumnIndex < 0)
            {
                return;
            }

            dataGridView1.ClearSelection();
            dataGridView1.Rows[e.RowIndex].Selected = true;
            var relativeMousePosition = dataGridView1.PointToClient(Cursor.Position);

            var clickedEntry = dataGridView1.Rows[e.RowIndex].DataBoundItem as RegisterEntry;

            var menu = new MenuItem(clickedEntry.Register + " - " + clickedEntry.HexValue);

            menu.Enabled = false;
            var m = new ContextMenu();

            m.MenuItems.Add(menu);
            m.MenuItems.Add(new MenuItem("Copy to &Clipboard", new EventHandler(MainForm.OnCopyToClipboard))
            {
                Tag = clickedEntry.HexValue
            });
            m.MenuItems.Add(new MenuItem("Add to &Watch List", new EventHandler(MainForm.OnAddWatch))
            {
                Tag = new AddWatchArgs(null, clickedEntry.Value, clickedEntry.Size)
            });
            m.MenuItems.Add(new MenuItem("Set &Breakpoint", new EventHandler(MainForm.OnAddBreakPoint))
            {
                Tag = new AddBreakPointArgs(null, clickedEntry.Value)
            });

            m.Show(dataGridView1, relativeMousePosition);
        }
Example #58
0
        // Evento RowHeaderMouseClick di dtgRubrica
        private void dtgRubrica_RowHeaderMouseClick(System.Object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
        {
            // Questa parte di codice serve per selezionare i dati da un record e successivamente l'utente
            // può decidere se eliminare o modificare uno o più campi del record , bisogna per fare ciò
            // impostare la proprietà Multiselect del datagridview a false
            // Prova
            try
            {
                // Assegno a txtNomeAttuale il contenuto della cella NOMEDataGridViewTextBoxColumn della riga selezionata
                this.txtNomeAttuale.Text = this.dtgRubrica.Rows[this.dtgRubrica.CurrentRow.Index].Cells["NOME"].Value.ToString();
                // Assegno a txtCognomeAttuale il contenuto della cella COGNOMEDataGridViewTextBoxColumn della riga selezionata
                this.txtCognomeAttuale.Text = this.dtgRubrica.Rows[this.dtgRubrica.CurrentRow.Index].Cells["COGNOME"].Value.ToString();
                // Assegno a txtTelefonoAttuale il contenuto della cella TELEFONODataGridViewTextBoxColumn della riga selezionata
                this.txtTelefonoAttuale.Text = this.dtgRubrica.Rows[this.dtgRubrica.CurrentRow.Index].Cells["TELEFONO"].Value.ToString();
                // Assegno a txtPosizioneRubricaAttuale il contenuto della cella POSIZIONERUBRICADataGridViewTextBoxColumn della riga selezionata
                this.txtPosizioneRubricaAttuale.Text = this.dtgRubrica.Rows[this.dtgRubrica.CurrentRow.Index].Cells["POSIZIONE_RUBRICA"].Value.ToString();
                // Abilito pulsante btnModifica
                btnModifica.Enabled = true;

                // Assegno a txtEliminaNome il contenuto della cella NOMEDataGridViewTextBoxColumn della riga selezionata
                this.txtEliminaNome.Text = this.dtgRubrica.Rows[this.dtgRubrica.CurrentRow.Index].Cells["NOME"].Value.ToString();
                // Assegno a txtEliminaCognome il contenuto della cella COGNOMEDataGridViewTextBoxColumn della riga selezionata
                this.txtEliminaCognome.Text = this.dtgRubrica.Rows[this.dtgRubrica.CurrentRow.Index].Cells["COGNOME"].Value.ToString();
                // Assegno a txtEliminaTelefono il contenuto della cella TELEFONODataGridViewTextBoxColumn della riga selezionata
                this.txtEliminaTelefono.Text = this.dtgRubrica.Rows[this.dtgRubrica.CurrentRow.Index].Cells["TELEFONO"].Value.ToString();
                // Assegno a txtEliminaPosizioneRubrica il contenuto della cella POSIZIONERUBRICADataGridViewTextBoxColumn della riga selezionata
                this.txtEliminaPosizioneRubrica.Text = this.dtgRubrica.Rows[this.dtgRubrica.CurrentRow.Index].Cells["POSIZIONE_RUBRICA"].Value.ToString();
                // Abilito pulsante btnElimina
                btnElimina.Enabled = true;

                // Nel caso di eccezzione
            }
            catch (Exception)
            {
                // Visualizzo un messaggio all'utente ad indicare che la riga del datagridview selezionata e priva di dati
                MessageBox.Show("Nessun nome,cognome o indirizzo selezionati", Application.ProductName.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }
Example #59
0
 private void DataGridView1_RowHeaderMouseClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
 {
     try {
         DataGridViewRow dr = DataGridView1.SelectedRows[0];
         this.Hide();
         My.MyProject.Forms.frmProject.Show();
         // or simply use column name instead of index
         //dr.Cells["id"].Value.ToString();
         My.MyProject.Forms.frmProject.txtID.Text               = dr.Cells[0].Value.ToString();
         My.MyProject.Forms.frmProject.txtProjectName.Text      = dr.Cells[1].Value.ToString();
         My.MyProject.Forms.frmProject.txtStudentName.Text      = dr.Cells[2].Value.ToString();
         My.MyProject.Forms.frmProject.cmbCourse.Text           = dr.Cells[3].Value.ToString();
         My.MyProject.Forms.frmProject.cmbYear.Text             = dr.Cells[4].Value.ToString();
         My.MyProject.Forms.frmProject.dtpSubmissionDate.Text   = dr.Cells[5].Value.ToString();
         My.MyProject.Forms.frmProject.txtRemarks.Text          = dr.Cells[6].Value.ToString();
         My.MyProject.Forms.frmProject.btnUpdate_record.Enabled = true;
         My.MyProject.Forms.frmProject.btnDelete.Enabled        = true;
         My.MyProject.Forms.frmProject.btnSave.Enabled          = false;
         My.MyProject.Forms.frmProject.txtProjectName.Focus();
     } catch (Exception ex) {
         MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
Example #60
0
        void dataGridView_ColumnHeaderMouseClick(object sender, System.Windows.Forms.DataGridViewCellMouseEventArgs e)
        {
            if (dataGridView.SortedColumn != null)
            {
                sortColumnName = dataGridView.SortedColumn.Name;

                string sortOrder = "ASC";

                if (dataGridView.SortOrder == System.Windows.Forms.SortOrder.Descending)
                {
                    sortOrder = "DESC";
                }

                sortExp = string.Format("[{0}] {1}", sortColumnName, sortOrder).Trim();

                if (sortColumnName.Equals("Page Position"))
                {
                    sortExp += string.Format(",[Tab Index] {1}", sortColumnName, sortOrder).Trim();
                }
            }

            ((BindingSource)this.dataGridView.DataSource).Sort = sortExp;
        }