[Mono-winforms-list] PictureBox, Resources and RTF text box problems

Natalia Portillo claunia at claunia.com
Sat Feb 6 16:36:56 EST 2010


El 04/02/2010, a las 19:15, Paul escribió:

> Hi,
>>> pictureBox1.Image = foo.Properties.Resources.filename where  
>>> filename is the
>>> string that contains the filename? I've tried casting the string,  
>>> but
>>> nothing.
>> pictureBox1.Image = Image.FromFile 
>> (foo.Properties.Resources.filename);
> Must be doing something wrong as I keep getting a file not found
> error...
> When I type foo.Properties.Resources. I get the list of resources
> stored. They don't have extensions listed. I've tried the filename  
> with
> and without the extension, but it still throws the error

There is a function to create a stream from a file, I suggest you to  
create the stream from the file and then the image from the steam.

>>> and it comes out in plain text. No formatting or anything like that.
>>> Am I missing something here?
>> Maybe OOO's RTF output is too complex for RichTextBox' little brain.
>> Try to edit this RTF file with WordPad (it comes with Windows).
>> This tool is known to generate suitable RTFs.
> Thanks. Am I loading it in correctly though?
> helptext.LoadFile(global::molarity.Properties.Resources.molarmass,
> RichTextBoxStreamType.RichText);

RichTextBox can load correct OOo's RTF, just if I remember well the  
method for loading with format is not LoadFile(), check MDSN  

More information about the Mono-winforms-list mailing list