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); }
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); }