Click here to Skip to main content
Licence CPOL
First Posted 12 Oct 2007
Views 16,394
Downloads 481
Bookmarked 16 times

Slide Show

By | 12 Oct 2007 | Article
This article describes how to create a simple presentation application
Screenshot - sampleimage.jpg

Introduction

This is a simple presentation program in which you can add slides, text, images and also assign simple animations to them.

Features of Classes

The code contains two user controls:

  • 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.

Using the Code

There are a number of classes in it.

One of the main classes is MainObject.cs.

 public MainObject()
        {

        }

There is also a class for dotted line...

public void drawLine(Graphics g)
        {
            Pen pen = new Pen(Color.Gray, thickness);

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

            int end = dis / (1 * length);

            double rad = angle / 180 * Math.PI;
            for (int i = 0; i < end - 1; i += distance)
                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))));
        }

... and for animation:

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;
                }

Using the Application

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.

History

  • 12th October, 2007: Initial post

License

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

About the Author

Ata Kirmani



Pakistan Pakistan

Member



Sign Up to vote   Poor Excellent
Add a reason or comment to your vote: x
Votes of 3 or less require a comment

Comments and Discussions

 
You must Sign In to use this message board. (secure sign-in)
 
Search this forum  
 FAQ
    Noise  Layout  Per page   
  Refresh
Generalgood one Pinmemberalrsds16:54 21 Sep '09  
Generalbrilliant PinmemberRibbonFan5:15 19 Nov '07  

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

Permalink | Advertise | Privacy | Mobile
Web04 | 2.5.120517.1 | Last Updated 13 Oct 2007
Article Copyright 2007 by Ata Kirmani
Everything else Copyright © CodeProject, 1999-2012
Terms of Use
Layout: fixed | fluid