Ejemplo n.º 1
0
        private void DataGridViewAccepted_KeyDown(object sender, KeyEventArgs e)
        {
            switch (e.KeyCode)
            {
            case Keys.Up:
                if (DataGridViewAccepted.SelectedCells[0].RowIndex == 0 && DataGridViewTasks.RowCount > 0)
                {
                    DataGridViewAccepted.DefaultCellStyle.SelectionForeColor = Color.DodgerBlue;
                    DataGridViewTasks.DefaultCellStyle.SelectionForeColor    = Color.ForestGreen;
                    DataGridViewTasks.Focus();
                    break;
                }
                if (DataGridViewAccepted.SelectedCells[0].RowIndex == 0 && DataGridViewTasks.RowCount == 0)
                {
                    Packages.mf.ButtonTasks.Focus();
                    Packages.mf.ButtonTasks.ForeColor = Color.Green;
                    DataGridViewAccepted.DefaultCellStyle.SelectionForeColor = Color.DodgerBlue;
                    DataGridViewTasks.DefaultCellStyle.SelectionForeColor    = Color.DodgerBlue;
                    MainFormClassic.infocontrol.Hide();
                    Packages.mf.Controls.Remove(MainFormClassic.infocontrol);
                    break;
                }
                break;

            case Keys.ControlKey:
                Point pCell = DataGridViewAccepted.GetCellDisplayRectangle(DataGridViewAccepted.CurrentCell.ColumnIndex, DataGridViewAccepted.CurrentCell.RowIndex, true).Location;
                MenuStripDataGrid.Show(pCell.X + MainFormClassic.tasks.Location.X + DataGridViewAccepted.Location.X + DataGridViewAccepted.Size.Width / 4, pCell.Y + MainFormClassic.tasks.Location.Y + DataGridViewAccepted.Location.Y + 23);
                MenuStripDataGrid.Items[0].Select();
                break;
            }
        }
Ejemplo n.º 2
0
        private void CheckRowCount()
        {
            if (DataGridViewAccepted.Rows.Count == 1)
            {
                if (DataGridViewTasks.Rows.Count > 0)
                {
                    DataGridViewAccepted.DefaultCellStyle.SelectionForeColor = Color.DodgerBlue;
                    DataGridViewTasks.DefaultCellStyle.SelectionForeColor    = Color.ForestGreen;
                    DataGridViewTasks.Focus();
                }
                else
                {
                    Packages.mf.ButtonTasks.Focus();
                    Packages.mf.ButtonTasks.ForeColor = System.Drawing.Color.Green;
                    DataGridViewTasks.DefaultCellStyle.SelectionForeColor = System.Drawing.Color.DodgerBlue;
                }
            }

            MainFormClassic.tasks.UpdateDataGrid();
            MainFormClassic.tasks.UpdateDataGridAcceptedTasks();
        }