Пример #1
0
 private void disposeCellPopup()
 {
     if (cellPopup != null)
     {
         cellPopup.Dispose();
         cellPopup = null;
     }
 }
Пример #2
0
 private void dataGrid_CellEnter(object sender, DataGridViewCellEventArgs e)
 {
     try
     {
         disposeCellPopup();
         TableListEntry entry = this.tableList.SelectedItem as TableListEntry;
         if (e.ColumnIndex >= 0 && e.RowIndex >= 0 && entry != null && dataGrid.GetCellCount(DataGridViewElementStates.Selected) == 1 &&
             dataGrid.SelectedCells[0].RowIndex == e.RowIndex && dataGrid.SelectedCells[0].ColumnIndex == e.ColumnIndex && dataGrid[e.ColumnIndex, e.RowIndex].IsInEditMode == false)
         {
             String[,] cellHit = null;
             if (entry.Table == this.tables.InitialAdvanceTiming || entry.Table == this.tables.ModifiedAdvanceTiming)
             {
                 cellHit = advanceTimingCellHit;
             }
             else if (entry.Table == this.tables.InitialBaseTiming || entry.Table == this.tables.ModifiedBaseTiming)
             {
                 cellHit = baseTimingCellHit;
             }
             if (cellHit != null)
             {
                 if (cellHit[e.ColumnIndex, e.RowIndex] != null)
                 {
                     cellPopup = new CellPopup();
                     cellPopup.textBox.Text = cellHit[e.ColumnIndex, e.RowIndex];
                     Rectangle r = dataGrid.GetCellDisplayRectangle(e.ColumnIndex, e.RowIndex, false);
                     cellPopup.Location = dataGrid.PointToScreen(new Point(r.Location.X + r.Width, r.Location.Y - cellPopup.Height));
                     cellPopup.Show(dataGrid);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("Error: " + ex.Message);
     }
 }