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
- Run Microsoft Visual Studio .NET.
- Select Visual C# Projects from tree view.
- Select the Smart Device Application template from templates & click Ok.
- A form will appear. Select Smartphone from Platform options and Windows Application from Project type.
2. Designing Form
- Form1.cs will be automatically added to the project.
- Main Menu control will be automatically added to the form1.cs.
- Add a Picture Box control, Image List Control and Timer Control to the form1.cs.
2.1 Program Image List Control
- Set the
ImageSize
property of the Image List control to the dimensions of your images (for example 180,180).
- Go to the images property of the Image List and Add Images (don't use large images).
2.2 Program the Timer Control
- Set timer control
Enabled
property to false
.
- Set the
Interval
property to any you want (for example, 5000).
- Write the following code to the timer tick event:
if(i<=6)
{
pictureBox1.Image =imageList1.Images[i];
i++;
else
{
i=0;
}
2.3 Program Main Menu
- Add two menu items Quit & Start.
- Double click on Quit and write the following code:
Application.Exit ();
- Double click on Start and write the following code:
if(menuItem2.Text =="Start" )
{
timer1.Enabled =true;
menuItem2.Text ="Stop" ;
}
else
{
timer1.Enabled =false;
menuItem2.Text ="Start" ;
}
3. Compiling & Running
- Run the application.
- Deployment form will appear. Select Smartphone 2003 Emulator (Virtual Radio) Default (if you do not have a smart phone).
- Click deploy.
- Program will be installed in the emulator. Press Start menu to view images.
- 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.
- 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