Click here to Skip to main content
15,886,518 members
Articles / Mobile Apps
Article

Image Slide Show For Smartphone Using C#

Rate me:
Please Sign up or sign in to vote.
3.50/5 (9 votes)
4 Dec 2005CPOL2 min read 55.9K   2.1K   24   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 <l1>this link<l1>.

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:
C#
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:

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

    C#
    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, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Business Analyst Valentia Technologies
Ireland Ireland
Mubi
^^^^^^^^^^^^^^^^^^^^^^^
www.mrmubi.com

Comments and Discussions

 
General.NET frame work Pin
alrsds13-Sep-09 18:10
alrsds13-Sep-09 18:10 

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

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