以下是我为其工作所遵循的步骤:
1.转到http://www.opennetcf.org/PermaLink.aspx?guid=d57ace50-2762-4b19-b07d-39421829d410并下载下载 SDF 2.0 Beta1 Redistributables。安装。
2.在针对 PPC 2003 SE 设备的 VS.NET 2005 中创建一个智能设备项目。我必须右键单击我的项目并选择“升级”以确保它针对的是 .NET CF v2.0 而不是 .NET CF 1.1 SP3。
3.我添加了OpenNETCF.dll和OpenNETCF.Drawing.dll文件作为默认安装目录(C:\Program Files\OpenNETCF\Smart Device Framework 2.0)的引用
4.我在表单上创建了一个带有图片框的简单应用程序,它会在加载表单时加载我的图像。以下是相关代码,其中一些是从 Alex Feinman 的网络日志中复制而来的:
#region Using directives
using System;
using System.Drawing;
using System.Collections;
using System.Windows.Forms;
using System.Runtime.InteropServices;
using OpenNETCF.Drawing.Imaging;
using System.IO;
#endregion
....
const string szFileName = @"\Storage Card\TEMP\2MBJPEG.JPG";
private void Form1_Load(object sender, EventArgs e)
{
IBitmapImage imageBitmap;
FileStream fsImage;
fsImage = new FileStream(
szFileName,
FileMode.Open);
imageBitmap = CreateThumbnail(
fsImage,
new Size(100, 100));
Bitmap bm = ImageUtils.IBitmapImageToBitmap(
imageBitmap);
pictureBox1.Image = bm;
}
static public IBitmapImage CreateThumbnail(Stream stream, Size size)
{
IBitmapImage imageBitmap;
ImageInfo ii;
IImage image;
ImagingFactory factory = new ImagingFactoryClass();
factory.CreateImageFromStream(
new StreamOnFile(stream),
out image);
image.GetImageInfo(out ii);
factory.CreateBitmapFromImage(
image,
(uint)size.Width,
(uint)size.Height,
ii.PixelFormat,
InterpolationHint.InterpolationHintDefault,
out imageBitmap);
return imageBitmap;
}