Re: ImageList for Console Application




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" <jp2msft@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:1F403A74-62AA-48FA-AB55-D45FF2E79802@xxxxxxxxxxxxxxxx
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?


.



Relevant Pages

  • Re: Unparsed Interchange
    ... But anything after that won´t work anymore (no xml validation, ... but have you tried setting your stream position ... // Get the original filename ... string filename = inmsg.Context.Read("ReceivedFileName", ...
    (microsoft.public.biztalk.general)
  • Re: Unparsed Interchange
    ... But anything after that won´t work anymore (no xml validation, ... but have you tried setting your stream position ... // Get the original filename ... string filename = inmsg.Context.Read("ReceivedFileName", ...
    (microsoft.public.biztalk.general)
  • RE: Unparsed Interchange
    ... but have you tried setting your stream position back ... from the received one (flat recieved -> xml out with some new parameters). ... // Get the original filename ... string filename = inmsg.Context.Read("ReceivedFileName", ...
    (microsoft.public.biztalk.general)
  • RE: Unparsed Interchange
    ... but have you tried setting your stream position back ... from the received one (flat recieved -> xml out with some new parameters). ... // Get the original filename ... string filename = inmsg.Context.Read("ReceivedFileName", ...
    (microsoft.public.biztalk.general)
  • file class
    ... private String _FileName; ... /// filename and all reqired parameters must be set up by user ... public TextFileServer(string FileName, int FixedRecordLen) ... //End of line built from constructor or user manual ...
    (microsoft.public.dotnet.languages.csharp)

Loading