Click here to Skip to main content
15,885,309 members
Articles / Multimedia / GDI+

Slide Show

Rate me:
Please Sign up or sign in to vote.
3.33/5 (8 votes)
12 Oct 2007CPOL 32.4K   1.4K   16  
This article describes how to create a simple presentation application
<!--------------------------------------------------------------------------->  
<!--                           INTRODUCTION                                

 The Code Project article submission template (HTML version)

Using this template will help us post your article sooner. To use, just 
follow the 3 easy steps below:
 
     1. Fill in the article description details
     2. Add links to your images and downloads
     3. Include the main article text

That's all there is to it! All formatting will be done by our submission
scripts and style sheets. 

-->  
<!--------------------------------------------------------------------------->  
<!--                        IGNORE THIS SECTION                            -->
<html>
<head>
<title>The Code Project</title>
<Style>
BODY, P, TD { font-family: Verdana, Arial, Helvetica, sans-serif; font-size: 10pt }
H2,H3,H4,H5 { color: #ff9900; font-weight: bold; }
H2 { font-size: 13pt; }
H3 { font-size: 12pt; }
H4 { font-size: 10pt; color: black; }
PRE { BACKGROUND-COLOR: #FBEDBB; FONT-FAMILY: "Courier New", Courier, mono; WHITE-SPACE: pre; }
CODE { COLOR: #990000; FONT-FAMILY: "Courier New", Courier, mono; }
</style>
<link rel="stylesheet" type=text/css href="http://www.codeproject.com/styles/global.css">
</head>
<body bgcolor="#FFFFFF" color=#000000>
<!--------------------------------------------------------------------------->  


<!-------------------------------     STEP 1      --------------------------->
<!--  Fill in the details (CodeProject will reformat this section for you) -->

<pre>
Title:       Slide Show
Author:      Ata Ullah Kirmani
Email:       ataullahkirmani@yahoo.com
Member ID:   2383381
Language:    C# 2.0 etc
Platform:    Windows, .NET 2.0 etc
Technology:  C#, GDI+
Level:       Intermediate, Advanced
Description: An article on animation

</pre>

<!-------------------------------     STEP 2      --------------------------->
<!--  Include download and sample image information.                       --> 

<ul class=download>
<li><a href="SlideShow_demo.zip">Download demo project - 16 Kb </a></li>
<li><a href="SlideShow_src.zip">Download source - 243 Kb</a></li>
</ul>

<p><img src="sampleimage.JPG" alt="Sample Image - maximum width is 600 pixels" width=735 height=630></p>


<!-------------------------------     STEP 3      --------------------------->
<!--  Add the article text. Please use simple formatting (<h2>, <p> etc)   --> 

<h2>Introduction</h2>

<p>This is a simple presentation programme in which you can add slides, text, images and also assign simple animations to them.
<h2>Features of classes </h2>

<p>The code contains  two user controls i.e textcontrol.cs, pictureControl.cs. There is also a class for dotted line by which you can add dotted lines, you can also determine its thickness , distance between the points and so on. 
<p>
<h2>Using the code</h2>

<p>There are a number of classes in it.
<p>One of the  main class is 
MainObject.cs.
<pre> public MainObject()<br>        {<br><br>        }</pre>


<p>There is also a class for dotted line. </p>
<pre>
//
// public void drawLine(Graphics g)
        {
            Pen pen = new Pen(Color.Gray, thickness);

            int  <code>dis  </code> = (int)Math.Sqrt((double)((x2 - x1) * (x2 - x1)) + (double)((y2 - y1) * (y2 - y1)));

            int <code>end </code>=<code> dis</code> / (1 * length);

            double <code>rad </code>= <code>angle</code> / 180 * Math.PI;
            for (int i = 0; i < <code>end</code> - 1; i += <code>distance</code>)
                g.DrawLine(pen, (float)(x1 + ((i * length) * (float)Math.Cos(rad))),
                               (float)(y1 + ((i * length) * (float)Math.Sin(rad))),
                               (float)(x1 + ((i + 1) * length * (float)Math.Cos(rad))),
                               (float)(y1 + ((i + 1) * length * (float)Math.Sin(rad))));


        }
//
</pre>

<p>and for animation 
<pre>
if (distance(tmpTextControl.X1,
             tmpTextControl.Y1,
             tmpTextControl.X2,
             tmpTextControl.Y2) > 5)
                {
                    //for animation
                    if (tmpTextControl.AnimationStarted)
                    {
                        tmpTextControl.Show = true;
                        tmpTextControl.X1 += (int)(
                            9.0 * Math.Cos(tmpTextControl.Direction));
                        tmpTextControl.Y1 += (int)(
                                9.0 * Math.Sin(tmpTextControl.Direction));
                    }
                }

                else
                {
                    if (i < customControl[currentSlide].Length - 1)
                        customControl[currentSlide][i+1].AnimationStarted = true;
                }
</pre>
<p>

<h2>Using the application </h2>
<p>You can add a control(i.e picture box or text box) from the insert menu and then click on the screen to place it there. For animation you have to select the control and then go to the animation menu and select the desired animation. A control can be edited by double clicking on it. <!-------------------------------    That's it!   --------------------------->
</p>
</body>
</html>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Pakistan Pakistan
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions