In Visual Studio 2003 and earlier, managing resources like images and icons in your project is somewhat difficult. For example, when you try to assign an image to a PictureBox through the property grid, you get the FileOpenDialog. When you pick an image file, the image is dumped into the form's resx file as a binary blob. If you want to use the same image in a different form (lets say all your forms have the same background image), you would need to pick the same image over and over again, thereby duplicating the binary blobs in each form's resx file. Now, what if you needed to edit the image, say, to insert a company logo? Not very easy. What if you decided to pick a new image? You need to do so all over again for all your forms. Also, the code to access the resources is weakly typed, i.e., something like:
this.BackgroundImage = (System.Drawing.Image) resources.GetObject(”MyImage.jpg”);
where 'resources' is of type ResourceManager.
One other thing: the default editor for resx files is a table of resource names. It isn't very easy to add new resources or edit existing ones.
Ofcourse, you can work around these limitations through code, but this is the default design time experience.
In Whidbey, we spent quite sometime thinking about how we could improve this experience. The result was that we designed a new model to store and access resources in Visual Studio projects. Here are some of the highlights of the new model:
Me.BackgroundImage = My.Resources.MyImage
in VB, and something similar in C# and J#.
This should help improve the overall experience around managing project resources. Do let us know how you find this new model when you get a chance to play with it!