J
Joe Cool
I am trying to add a project resource image to a contextmenustrip
menuitem in code. Here is the code:
ContextMenuStrip cm = new ContextMenuStrip();
Image image;
Stream s;
s = this.GetType().Assembly.GetManifestResourceStream
("myProjectName.resourcepicturename");
image = Image.FromStream(s);
cm.Items.Add(new ToolStripMenuItem("Menu Item Text",
image, this.MenuItemHandler_Click));
It dies trying to assign the image from the stream to the Image
variable. Error is:
Value of 'null' is not valid for 'stream'.
Any help appreciated.
menuitem in code. Here is the code:
ContextMenuStrip cm = new ContextMenuStrip();
Image image;
Stream s;
s = this.GetType().Assembly.GetManifestResourceStream
("myProjectName.resourcepicturename");
image = Image.FromStream(s);
cm.Items.Add(new ToolStripMenuItem("Menu Item Text",
image, this.MenuItemHandler_Click));
It dies trying to assign the image from the stream to the Image
variable. Error is:
Value of 'null' is not valid for 'stream'.
Any help appreciated.