Example #1
0
        void LoadPictures()
        {
            // Free the resources for any previous slide show: sets all images to null
            UnloadPictures();

            // Load the main picture
            LoadMain();

            // Load the picture strip
            for (int i = 0; i < 5; i++)
            {
                string slidePath = iSlideShow.GetPath(i - 2);
                if (slidePath != null)
                {
                    string picStrip = Path.Combine(iWorkingFolder, slidePath);
                    if (File.Exists(picStrip))
                    {
                        iPictureStrip[i].Image = System.Drawing.Bitmap.FromFile(picStrip);
                    }
                }
            }

            iCaptionChanged            = false;
            toolStripProgressBar.Value = iCurrentPosition;
        }
Example #2
0
        //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;
            }
        }