Wednesday, February 5, 2014

Create a simple Slide Show in C #


This is a post I am related to C # (C sharp). In this post, I will explain the steps of making the application or image viewer slide show from C #. Tutorial on creating a simple slide show application is part of the C # application usage as it relates to the management of the image. The pictures that we have can be made into a slide show or be used as a tutorial for the display in C #. Now it's time to direct the implementation of the program.
Starting from the simplest, though probably many of you already know very well about the programming language one, namely how to make a simple slide show or any type of image viewer using C #. In each implementation I use Microsoft Visual Studio 2012.
Please read:
1. the first step, open the C # program and create a new file by choosing File > > New Project (Ctrl + Shift + N) > > select Windows Application, and name the file as per your liking (SlideShow) and press OK. Next would come an empty form.



2. a Component used for this simple program is:
• folderBrowserDialog

• Timer
• Panel
• PictureBox
• Button
Click and put option component of the program which will be used as the image below:

3. Then double click on the button "Open Folder" and add the following code:


   if (folderBrowserDialog2.ShowDialog() == DialogResult.OK)
            {
                string[] part1 = null, part2 = null, part3 = null;

                part1 = System.IO.Directory.GetFiles(folderBrowserDialog2.SelectedPath, "*.jpg");
                part2 = System.IO.Directory.GetFiles(folderBrowserDialog2.SelectedPath, "*.jpeg");
                part3 = System.IO.Directory.GetFiles(folderBrowserDialog2.SelectedPath, "*.bmp");

                folderFile = new string[part1.Length + part2.Length + part3.Length];

                Array.Copy(part1, 0, folderFile, 0, part1.Length);
                Array.Copy(part2, 0, folderFile, part1.Length, part2.Length);
                Array.Copy(part3, 0, folderFile, part1.Length + part2.Length, part3.Length);

                selected = 0;
                begin = 0;
                end = folderFile.Length;

                showImage(folderFile[selected]);
            }

The goal of the Open Folder button to select the file image is what you'd like displayed in the picture box. The desired file types can be specified via the syntax Filter (in the above example file.Filter), whereas if you want to directly refer to a particular directory can be used syntax InitialDirectory (in the above example file.InitialDirectory)

4. as for the picks up a slide show, double click on the button "Start Slide Show" and add the following code:


            if(timer1.Enabled == true)
                     {
                           timer1.Enabled = false;
                           button4.Text = "<< START Slide Show >>";
                     }
                     else
                     {
                           timer1.Enabled = true;
                           button4.Text = "<< STOP Slide Show >>";
                     }

Add the source code below:


        private System.Windows.Forms.Panel panel1;
        private System.Windows.Forms.Button button1;
        private System.Windows.Forms.Button button2;
        private System.Windows.Forms.Button button3;
        private System.Windows.Forms.PictureBox pictureBox1;
        private string[] folderFile = null;
        private int selected = 0;
        private int begin = 0;
        private int end = 0;
        private System.Windows.Forms.Button button4;

5. in the writing of this .dll dibutuhlan code from IO.ESE dll.
Add the following code:

using System.IO;

6. the application is complete, after adding the source code above, lives in the run course. And the results were as follows:





For more details on this please downlaod program understanding program files and full-length project
download program files here
download full project here
download the exe only here
for more information contact on ardhamail@gmail.com

Guide to download: click the download link provided above, a page will appear after that adf.ly, wait a few seconds until appears on the top right corner of the ad skip writing. Click the button, the page will appear after that ziddu, please click on the download button that appears on the page ziddu
NB: in this tutorial ditulisa program using the Visual studio IDE. with the target framework > 4.0. So at a minimum your computer must be installed or windows vista or windows xp with the .NET framework 4.0 to be able to run programs *. exe, while for open projectnya inevitably must install microsoft visual studio 2012

1 comments: