I'm currently designing a windows mobile application using compact framework 3.5 and I need to be able to display pictures taken by the user for paths that I have previously stored.
At the moment all I di开发者_运维知识库d was to create a new form dialog, that loads the picture into a PictureBox like this:
public formPictureViewer(string fileName)
{
InitializeComponent();
pictureBox.Image = new Bitmap(fileName);
}
The above approach is very simple, but it has the disadvantage that it does not allow the user to zoom in the image or to view it in full screen, unless all these features are programmed in to the form. What I would like is to simply call or execute the picture in the same dialog/viewer that opens up when clicking a .jpg file in the content manager/file manager of the smartphone. Probably this is the default viewer associated with the file in windows mobile, and it does have funcions for zooming in, full screen mode, setting as wallpaper, etc.
Maybe it's a very simple thing like calling something similar to ShellExecute... I'ts just that I'm new to the compact framework/windows mobile development and don't know all the tricks yet...
You can use the System.Diagnostics namespace to call the built in picture/image viewer (pimg.exe)
ProcessStartInfo psi = new ProcessStartInfo();
psi.FileName = @"\Windows\pimg.exe";
psi.Arguments = @"\My Documents\My Pictures\Flower.jpg";
Process.Start(psi);
精彩评论