I guess one off the wall idea is to write out the the TEMP folder. And pop
the default application.
I don't know if this will work with a stream from the resource..but here is
my crappy string/file version.
It should convey the idea.
If you swap out to an image file extension
fileName = fileName.Replace(".tmp", ".jpg");
and work out the details of the stream writing..maybe its a poor man's fix
for showing images with a console application.
public void Test1()
string fileName = WriteToTempFile("Hi There");
System.Diagnostics.Process.Start(fileName);
}
public string WriteToTempFile(string toWrite)
{
System.IO.StreamWriter writer = null;
System.IO.FileStream fs = null;
string fileName = string.Empty;
try
{
// Writes text to a temporary file and returns path
fileName = System.IO.Path.GetTempFileName();
fileName = fileName.Replace(".tmp", ".txt");
fs = new System.IO.FileStream(fileName,
System.IO.FileMode.Append, System.IO.FileAccess.Write);
// Opens stream and begins writing
writer = new System.IO.StreamWriter(fs);
writer.BaseStream.Seek(0, System.IO.SeekOrigin.End);
writer.WriteLine(toWrite);
writer.Flush();
}
finally
{
if (null != writer)
{
writer.Close();
}
if (null != fs)
{
fs.Close();
}
}
return fileName;
}
"jp2msft" <jp*****@discussions.microsoft.comwrote in message
news:1F**********************************@microsof t.com...
>I am experimenting with a concept the engineers want.
I want to create an app that runs in the console. When an event happens, I
want to display an image.
Can I do this without having a form?
Right now, my app compiles, but crashes with an unhandled exception at
this
part:
//
this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)
resources.GetObject("imageList1.ImageStream")));
//
It is erroring because I do not have anything called
"imageList1.ImageStream".
How would I define something like this?
I included a Resources.resx file, and loaded several images into it. I
just
don't know how to access them.
Can anyone help?