//protected override void OnPaint(PaintEventArgs e) //{ // Bitmap canvas = new Bitmap(this.Width, this.Height, // PixelFormat.Format16bppRgb565); // Graphics canvasGraphics = Graphics.FromImage(canvas); // Image photo = new Image(); // canvasGraphics.DrawImage(photo, new Point(0, 0)); //} private void timer1_Tick(object sender, EventArgs e) { // Ensure that we are set to any change in the required interval. transitionTimer.Interval = iSlideParameters.Speed; // Free the resources for any previous slide if (pictureBox1.Image != null) { pictureBox1.Image.Dispose(); } if (iEndOfShow) { // End of slide show transitionTimer.Stop(); controlTimer.Stop(); this.Close(); } else { // Load the current slide string slidePath = iSlideShow.GetPath(); string pic1 = Path.Combine(iWorkingFolder, slidePath); if (File.Exists(pic1)) // Tolerate non-existence of image file { pictureBox1.Image = System.Drawing.Bitmap.FromFile(pic1); captionTextBox.Visible = false; // Assume no caption if (iSlideParameters.ShowCaptions) { List <String> caption = iSlideShow.Lines; if ((caption != null) && (caption.Count > 0) && PopulateCaptionTextBox(caption)) { captionTextBox.Visible = true; } } } } // Advance to next slide if (!iSlideShow.NextSlide()) { // No more slides, so terminate on next timer tick iEndOfShow = true; } }
private void rightButton_Click(object sender, EventArgs e) { CheckCaptionChanged(); if (iSlideShow.NextSlide()) { iCurrentPosition++; // Left hand picture disappears if (iPictureStrip[0].Image != null) { iPictureStrip[0].Image.Dispose(); } // Other pictures shunt along for (int i = 0; i < 4; i++) { iPictureStrip[i].Image = iPictureStrip[i + 1].Image; } // Replace final picture iPictureStrip[4].Image = null; string slidePath = iSlideShow.GetPath(2); if (slidePath != null) { string picStrip = Path.Combine(iWorkingFolder, slidePath); if (File.Exists(picStrip)) { iPictureStrip[4].Image = System.Drawing.Bitmap.FromFile(picStrip); } } // Replace main picture LoadMain(); } iCaptionChanged = false; toolStripProgressBar.Value = iCurrentPosition; }