Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Image Slide Show For Smartphone Using C#

0.00/5 (No votes)
4 Dec 2005 1  
Creating a slide show program for Smartphone using .NET technology
Sample Image - SmartImagination.jpg

Introduction

In this article, we will see how to create a simple image slide show application for Smartphone using Microsoft .NET technology (using C#).

Prerequisite

In order to start Smartphone application development, make sure that you have installed "SDK for Windows Mobile 2003-based Smartphones" add on for Visual Studio .NET 2003 on your PC.
If you don't have installed it yet, you can download it free from this link.

Starting Development

1. Select Project Type

  1. Run Microsoft Visual Studio .NET.
  2. Select Visual C# Projects from tree view.
  3. Select the Smart Device Application template from templates & click Ok.
  4. A form will appear. Select Smartphone from Platform options and Windows Application from Project type.

2. Designing Form

  1. Form1.cs will be automatically added to the project.
  2. Main Menu control will be automatically added to the form1.cs.
  3. Add a Picture Box control, Image List Control and Timer Control to the form1.cs.

2.1 Program Image List Control

  1. Set the ImageSize property of the Image List control to the dimensions of your images (for example 180,180).
  2. Go to the images property of the Image List and Add Images (don't use large images).

2.2 Program the Timer Control

  1. Set timer control Enabled property to false.
  2. Set the Interval property to any you want (for example, 5000).
  3. Write the following code to the timer tick event:
if(i<=6) //where 6 is max image index, you can dynamically get it
{ 
pictureBox1.Image =imageList1.Images[i]; //show next image 
i++;  //increment counter for image display} 
else 
{ 
i=0; //reset counter for image display counter to repeat images 
} 

2.3 Program Main Menu

  1. Add two menu items Quit & Start.
  2. Double click on Quit and write the following code:

    Application.Exit (); 
  3. Double click on Start and write the following code:

    if(menuItem2.Text =="Start" )//Check for action start or stop
    { 
    timer1.Enabled =true; //Start slide show
    menuItem2.Text ="Stop" ; //change next action state to stop slide
    } 
    else 
    { 
    timer1.Enabled =false; //stop timer as per action
    menuItem2.Text ="Start" ; //change next action state to start
    } 

3. Compiling & Running

  1. Run the application.
  2. Deployment form will appear. Select Smartphone 2003 Emulator (Virtual Radio) Default (if you do not have a smart phone).
  3. Click deploy.
  4. Program will be installed in the emulator. Press Start menu to view images.
  5. In order to install it to your Smartphone device, connect your device via Microsoft active sync, and select option Smartphone device in step 2. Active sync will automatically install the .NET Framework and image slide show application to your device.
  6. If you want to publish your application; create the Cab file (Build>Build Cab File...) and make this cab file downloadable from some website or email to any of your friends. They will be able to download and install it.

4. Troubleshoot

There may be times you should be able to compile the application successfully, but you can't deploy to Emulator or Smartphone device. You may get an unexpected error, then close your .NET IDE and open the project again, then deploy, this will solve the problem.

History

  • 4th December, 2005: Initial post

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here