Example #1
0
        public void update(List <ApplicationRecord> pRecordList)
        {
            bool lIsLastLine    = false;
            int  lLastPosition  = -1;
            int  lLastRowIndex  = -1;
            int  lSelectedIndex = -1;


            lock (this)
            {
                /*
                 * Remember DGV positions
                 */
                if (DGV_Applications.CurrentRow != null && DGV_Applications.CurrentRow == DGV_Applications.Rows[DGV_Applications.Rows.Count - 1])
                {
                    lIsLastLine = true;
                }

                lLastPosition = DGV_Applications.FirstDisplayedScrollingRowIndex;
                lLastRowIndex = DGV_Applications.Rows.Count - 1;

                if (DGV_Applications.CurrentCell != null)
                {
                    lSelectedIndex = DGV_Applications.CurrentCell.RowIndex;
                }

                cApplications.Clear();
                foreach (ApplicationRecord lTmp in pRecordList)
                {
                    cApplications.Add(lTmp);
                }

                // Selected cell/row
                try
                {
                    if (lSelectedIndex >= 0)
                    {
                        DGV_Applications.CurrentCell = DGV_Applications.Rows[lSelectedIndex].Cells[0];
                    }
                }
                catch (Exception) { }


                // Reset position
                try
                {
                    if (lLastPosition >= 0)
                    {
                        DGV_Applications.FirstDisplayedScrollingRowIndex = lLastPosition;
                    }
                }
                catch (Exception) { }

                DGV_Applications.Refresh();
            } // lock (thi...
        }
Example #2
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void DGV_Applications_MouseUp(object sender, MouseEventArgs e)
 {
     if (e.Button == MouseButtons.Right)
     {
         try
         {
             DataGridView.HitTestInfo hti = DGV_Applications.HitTest(e.X, e.Y);
             if (hti.RowIndex >= 0)
             {
                 CMS_Applications.Show(DGV_Applications, e.Location);
             }
         }
         catch (Exception lEx) { }
     }
 }
Example #3
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void DGV_Applications_MouseDown(object sender, MouseEventArgs e)
        {
            try
            {
                DataGridView.HitTestInfo hti = DGV_Applications.HitTest(e.X, e.Y);

                if (hti.RowIndex >= 0)
                {
                    DGV_Applications.ClearSelection();
                    DGV_Applications.Rows[hti.RowIndex].Selected = true;
                    DGV_Applications.CurrentCell = DGV_Applications.Rows[hti.RowIndex].Cells[0];
                }
            }
            catch (Exception)
            {
                DGV_Applications.ClearSelection();
            }
        }