private void leftButton_Click(object sender, EventArgs e) { CheckCaptionChanged(); if (iSlideShow.PrevSlide()) { iCurrentPosition--; // Right hand picture disappears if (iPictureStrip[4].Image != null) { iPictureStrip[4].Image.Dispose(); } // Other pictures shunt along for (int i = 4; i > 0; i--) { iPictureStrip[i].Image = iPictureStrip[i - 1].Image; } // Replace first picture iPictureStrip[0].Image = null; string slidePath = iSlideShow.GetPath(-2); if (slidePath != null) { string picStrip = Path.Combine(iWorkingFolder, slidePath); if (File.Exists(picStrip)) { iPictureStrip[0].Image = System.Drawing.Bitmap.FromFile(picStrip); } } // Replace main picture LoadMain(); } iCaptionChanged = false; toolStripProgressBar.Value = iCurrentPosition; }
private void SlideViewerForm_KeyDown(object sender, KeyEventArgs e) { switch (e.KeyCode) { // Scroll case Keys.Add: case Keys.Oemplus: if (iSlideParameters.Speed > MinSlideSpeedMs) { iSlideParameters.Speed -= DeltaSlideSpeedMs; transitionTimer.Interval = iSlideParameters.Speed; transitionTimer.Stop(); transitionTimer.Start(); // Restart transition timing } ShowSpeedControl(); break; case Keys.Subtract: case Keys.OemMinus: if (iSlideParameters.Speed < MaxSlideSpeedMs) { iSlideParameters.Speed += DeltaSlideSpeedMs; transitionTimer.Interval = iSlideParameters.Speed; transitionTimer.Stop(); transitionTimer.Start(); // Restart transition timing } ShowSpeedControl(); break; case Keys.Right: timer1_Tick(null, null); // Transition to next slide now break; case Keys.Left: // Try to transition to previous slide if (iSlideShow.PrevSlide() && iSlideShow.PrevSlide()) { timer1_Tick(null, null); } break; case Keys.C: iSlideParameters.ToggleCaptions(); ShowCaptionControl(); break; case Keys.Escape: iEndOfShow = true; timer1_Tick(null, null); break; default: // Ignore key stroke: uncomment the following to display the key pressed //System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder(); //messageBoxCS.AppendFormat("{0} = {1}", "Alt", e.Alt); //messageBoxCS.AppendLine(); //messageBoxCS.AppendFormat("{0} = {1}", "Control", e.Control); //messageBoxCS.AppendLine(); //messageBoxCS.AppendFormat("{0} = {1}", "Handled", e.Handled); //messageBoxCS.AppendLine(); //messageBoxCS.AppendFormat("{0} = {1}", "KeyCode", e.KeyCode); //messageBoxCS.AppendLine(); //messageBoxCS.AppendFormat("{0} = {1}", "KeyValue", e.KeyValue); //messageBoxCS.AppendLine(); //messageBoxCS.AppendFormat("{0} = {1}", "KeyData", e.KeyData); //messageBoxCS.AppendLine(); //messageBoxCS.AppendFormat("{0} = {1}", "Modifiers", e.Modifiers); //messageBoxCS.AppendLine(); //messageBoxCS.AppendFormat("{0} = {1}", "Shift", e.Shift); //messageBoxCS.AppendLine(); //messageBoxCS.AppendFormat("{0} = {1}", "SuppressKeyPress", e.SuppressKeyPress); //messageBoxCS.AppendLine(); //MessageBox.Show(messageBoxCS.ToString(), "KeyDown Event"); break; } }