Beispiel #1
0
 private void frm_NextRecord(object sender, RecordPositionEventArgs e)
 {
     if (_EventIndex < this.GridView.Rows.Count - 1)
     {
         this.GridView.Rows[_EventIndex].Selected = false;
         _EventIndex++;
         this.GridView.Rows[_EventIndex].Selected = true;
         if (_EventIndex > this.GridView.FirstDisplayedScrollingRowIndex + this.GridView.DisplayedRowCount(false) - 1)
         {
             this.GridView.FirstDisplayedScrollingRowIndex += this.GridView.DisplayedRowCount(false);
         }
         string path = string.Empty;
         if (this.GridView.Rows[_EventIndex].Tag is SpeedingRecord)
         {
             SpeedingRecord info = this.GridView.Rows[_EventIndex].Tag as SpeedingRecord;
             path = info.Photo;
         }
         else if (this.GridView.Rows[_EventIndex].Tag is SpeedingLog)
         {
             SpeedingLog info = this.GridView.Rows[_EventIndex].Tag as SpeedingLog;
             path = info.Photo;
         }
         FrmPhotoViewer frm = sender as FrmPhotoViewer;
         frm.ShowImage(path);
     }
     e.IsButtonRecord = (_EventIndex == GridView.Rows.Count - 1);
 }
Beispiel #2
0
 private void frm_PreRecord(object sender, RecordPositionEventArgs e)
 {
     if (_EventIndex > 0)
     {
         this.GridView.Rows[_EventIndex].Selected = false;
         _EventIndex--;
         this.GridView.Rows[_EventIndex].Selected = true;
         if (_EventIndex < this.GridView.FirstDisplayedScrollingRowIndex)
         {
             if (this.GridView.FirstDisplayedScrollingRowIndex >= this.GridView.DisplayedRowCount(false))
             {
                 this.GridView.FirstDisplayedScrollingRowIndex -= this.GridView.DisplayedRowCount(false);
             }
             else
             {
                 this.GridView.FirstDisplayedScrollingRowIndex = 0;
             }
         }
         string path = string.Empty;
         if (this.GridView.Rows[_EventIndex].Tag is SpeedingRecord)
         {
             SpeedingRecord info = this.GridView.Rows[_EventIndex].Tag as SpeedingRecord;
             path = info.Photo;
         }
         else if (this.GridView.Rows[_EventIndex].Tag is SpeedingLog)
         {
             SpeedingLog info = this.GridView.Rows[_EventIndex].Tag as SpeedingLog;
             path = info.Photo;
         }
         FrmPhotoViewer frm = sender as FrmPhotoViewer;
         frm.ShowImage(path);
     }
     e.IsTopRecord = (_EventIndex == 0);
 }
Beispiel #3
0
        private void customDataGridview1_CellDoubleClick(object sender, DataGridViewCellEventArgs e)
        {
            if (e.RowIndex > -1 && e.ColumnIndex >= 0)
            {
                _EventIndex = e.RowIndex;
                string path = string.Empty;
                if (this.GridView.Rows[e.RowIndex].Tag is SpeedingRecord)
                {
                    SpeedingRecord info = this.GridView.Rows[e.RowIndex].Tag as SpeedingRecord;
                    path = info.Photo;
                }
                else if (this.GridView.Rows[e.RowIndex].Tag is SpeedingLog)
                {
                    SpeedingLog info = this.GridView.Rows[e.RowIndex].Tag as SpeedingLog;
                    path = info.Photo;
                }

                FrmPhotoViewer frm = new FrmPhotoViewer();
                frm.PreRecord  += new RecordPositionEventHandler(frm_PreRecord);
                frm.NextRecord += new RecordPositionEventHandler(frm_NextRecord);
                frm.ShowImage(path);
                frm.ShowDialog();
                frm.PreRecord  -= new RecordPositionEventHandler(frm_PreRecord);
                frm.NextRecord -= new RecordPositionEventHandler(frm_NextRecord);
            }
        }