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

Robert Jordan robertj at gmx.net
Wed Feb 3 10:06:54 EST 2010


On 03.02.2010 15:44, PFJ wrote:
>
> I have a pile of resources for a project which the resource manager handles
> quite nicely. I have an XML file which contains the name of the resource,
> but stored as a string rather than as an Image (it's the name of the
> resource).
>
> Is there a way that I can have
>
> 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);

> I have an rtf text box and I have two rtf files held in the resources. I
> created the rtf files in OpenOffice and can load them back in and the
> formatting is there.
>
> I try to load them into a form using
>
> helptext.LoadFile(global::molarity.Properties.Resources.molarmass,
> RichTextBoxStreamType.RichText);
>
> 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.

Robert



More information about the Mono-winforms-list mailing list