StrataFrame Forum

Add resources to a control subclass

http://forum.strataframe.net/Topic8934.aspx

By Greg McGuffey - 5/21/2007

I'm sub classing a toolstrip and want to preadd some buttons (just like you do on you RichTextboxToolStrip control). I can add the designer file, with the code that adds the toolstripbuttons/combos/etc. but can't figure out how to add the resource file with the images for the buttons. If I add a resource file, I have to add a dependency manually to the main file. If I add resources to it via the property sheet, it gives me a warning about corrupting the form/control.



So, how do I add a resource to the control?
By StrataFrame Team - 5/22/2007

Generally, on a ToolStripButton, you can just set the Image on the property sheet, and the designer will automatically create the .resx file for your component and add it to the project (if you select local resource in the editor for the image).  You can also select project resource from there, which will use the project's .resx file.

You should never have to manually add an .resx file to a component... when you set a property that tries to use the resource file, it will create one automatically the first time it needs one.

Now, if it's giving you that error when you just try to set the Image property on a tool strip button, then there might be other problems...

By Greg McGuffey - 5/22/2007

Doh...Yep, there is it, the Items collection. One of these days I'll start getting .NET enough to stop asking silly questions Blush In the mean time, thanks for you help!
By StrataFrame Team - 5/23/2007

Hehe, everyone has to learn.  It's better to ask and learn from the answer than to bang your head for 2 days trying to figure it out Smile