New To Windows CE Development

B

Bill Petzke

I have been developing an imaging application for a
Windows CE device utilizing Visual Studio .NET 2003 and
the .NET Compact Framework.

I am not sure how to reference images installed as content
with the application since I don't understand how paths
are mapped on a CE device.

It seems like there should be a way to reference the
directory of the running application. The other
possibility is to use images as embedded resources.

Unfortunately I have found the documentation on embedding
images into assemblies very weak and haven't really found
any way to access the current path of the running
application. Any direction as to the preferrable method
of accessing images on a CE device would be appreciated.
If anyone knows how to create embedded images and or
reference the working directory I would also appreciate
your help.
 
P

Pete Vickers [eMVP]

Hi,
for the path of the application,
System.Reflection.Assembly.GetExecutingAssembly().GetName().CodeBase

If you want to embed images into an image list, add them to your program,
and then set the build action to 'embedded resource'
Then
Me.imagelist1.imagesize = new system.drawing.size (wid,hght)
Dim picBmp as New
Bitmap([Assembly].GetExecutingAssembly().GetManifestResourceStream("xx.pic.b
mp")
ImageList1.Images.Add(picbmp)

Where xx is the assembly name

HTH

Pete
 
H

Hollywood

I am not sure how to reference images installed as content
with the application since I don't understand how paths
are mapped on a CE device.
System.Reflection.Assembly.GetCallingAssembly().GetName().CodeBase;

It seems like there should be a way to reference the
directory of the running application. The other
possibility is to use images as embedded resources.

protected StreamReader GetEmbeddedXMLResource(string sAppName, string
sResName, string sExt)
{
sResName = sAppName + "." + sResName.Replace("/", ".").Replace("\\", ".") +
"." + sExt;

Stream strmResource =
Assembly.GetExecutingAssembly().GetManifestResourceStream(sResName);
if (strmResource != null)
return new StreamReader(strmResource);

return null;
}
If anyone knows how to create embedded images and or
reference the working directory I would also appreciate
your help.

At design time you can embed them by adding them to the project and setting
them as an Embedded Resource.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top