Showing an image with picturebox using Pocket PC Emulator in c#

13 07 2008

Showing an image using Pocket PC Emulator isn’t same as using windows application as usual. You must insert your folder that contains image you want to be shown in ‘virtual’ Storage Card. You can do this by doing this : In Pocket PC, open

File => Configure => General => Shared Folder.

In Shared Folder, you must insert the address of your folder (ex. “C:\Documents and Settings\All Users\Documents\My Pictures”) then click OK.

After that, drag PictureBox and Button from ToolBox when you show Form1.cs[design] to Pocket PC Emulator.

Do this code for example:

1   using System;
2   using System.Collections.Generic;
3   using System.ComponentModel;
4   using System.Data;
5   using System.Drawing;
6   using System.Text;
7   using System.Windows.Forms;
8   using System.Drawing.Imaging;
9   using System.IO;
10
11 namespace DeviceApplication1
12 {
13      public partial class Form1 : Form
14      {
15             public Form1()
16             {
17                    InitializeComponent();
18             }
19
20            private void button1_Click(object sender, EventArgs e)
21            {
22                 Bitmap gambar = new Bitmap(@”/Storage Card/Lenna.png”);
23                 pictureBox1.Image = gambar;
24                 pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage; //to make an
25                 //image fit to screen
26                 pictureBox1.Show();
27           }
28
29           private void pictureBox1_Click(object sender, EventArgs e)
30           {
31
32           }
33      }
34 }

Build and Debug it. Click the button you has created, and the image will appear.


Actions

Information

3 responses

26 02 2009
joseph

Hi

thank you for sharing this one… I have tried it but I encounter problem. I got an exception saying

“Could not find part of the path ‘\C:\picture.bmp’ “.

hoping that you could help me

many thanks

Joseph

27 02 2009
Renita Fransisca

in which line for path ‘\C:\picture.bmp’ ?

13 04 2009
Sherjeel Shabih

Thanks bro! Love you!!! Needed it for some app. thanks again!

Leave a comment