Share image resources between projects

Share image resources between projects

am 17.10.2007 23:30:27 von bbrewder

I am interested in hearing how other people have handled sharing
resources in multiple projects (for example, a save icon).

We have a product that has many forms within many projects. Many of
these forms have a save button with an icon (along with other common
buttons and icons). At this point, we've added the icon to each
project.

Unfortunately, if we want to change the icon, we now have to go to
every project and change it. It would be nice if all the buttons used
an icon from a shared resource assembly but I can't figure out how to
enable something like that in the designer.

Any ideas would be appreciated.

Re: Share image resources between projects

am 18.10.2007 13:56:44 von Kevin Spencer

You can embed the image as a resource into a DLL assembly.

--
HTH,

Kevin Spencer
Chicken Salad Surgeon
Microsoft MVP

"bbrewder" wrote in message
news:1192656627.527692.52130@q3g2000prf.googlegroups.com...
>I am interested in hearing how other people have handled sharing
> resources in multiple projects (for example, a save icon).
>
> We have a product that has many forms within many projects. Many of
> these forms have a save button with an icon (along with other common
> buttons and icons). At this point, we've added the icon to each
> project.
>
> Unfortunately, if we want to change the icon, we now have to go to
> every project and change it. It would be nice if all the buttons used
> an icon from a shared resource assembly but I can't figure out how to
> enable something like that in the designer.
>
> Any ideas would be appreciated.
>

Re: Share image resources between projects

am 22.10.2007 15:01:48 von CassioT

I have the same problem. I could embed the images into a dll assembly
but I don't know how access them while designing the screen. Can
anyone tell me how?

Thank you,

Cassio Tavares

On 18 out, 09:56, "Kevin Spencer" wrote:
> You can embed the image as a resource into a DLL assembly.
>
> --
> HTH,
>
> Kevin Spencer
> Chicken Salad Surgeon
> Microsoft MVP
>
> "bbrewder" wrote in message
>
> news:1192656627.527692.52130@q3g2000prf.googlegroups.com...
>
> >I am interested in hearing how other people have handled sharing
> > resources in multiple projects (for example, a save icon).
>
> > We have a product that has many forms within many projects. Many of
> > these forms have a save button with an icon (along with other common
> > buttons and icons). At this point, we've added the icon to each
> > project.
>
> > Unfortunately, if we want to change the icon, we now have to go to
> > every project and change it. It would be nice if all the buttons used
> > an icon from a shared resource assembly but I can't figure out how to
> > enable something like that in the designer.
>
> > Any ideas would be appreciated.

Re: Share image resources between projects

am 22.10.2007 22:35:54 von bbrewder

I ended up creating a resource assembly, using the resource generator
from Code Project (http://www.codeproject.com/dotnet/
ResXFileCodeGeneratorEx.asp - creates a strongly typed class for
resources that is public), adding a new property to the button control
for the image type (I need this for icons on buttons so the image
types would be open, create new, save, close, delete, etc.). When the
user sets the image type, I get the image set (both the small and
large icon) from the resource file.

I used a UITypeEditor to display a list of the available image types
which I got from the resource class (I could have used a
TypeConverter, but I already had a convenient base UITypeEditor
available). If the image type property is set, I do not serialize the
image properties (if the image properties are serialized, the images
will be added to the project).

This is certainly not a simple process (it took me a couple of hours
and I am fairly experienced with many of these designer issues) and it
forced me to do some odd things to make it work. I hope VS 2008 allows
external resource assemblies to be used in the WinForms designer.

Brian Brewder

On Oct 22, 6:01 am, CassioT wrote:
> I have the same problem. I could embed the images into a dll assembly
> but I don't know how access them while designing the screen. Can
> anyone tell me how?
>
> Thank you,
>
> Cassio Tavares
>
> On 18 out, 09:56, "Kevin Spencer" wrote:
>
>
>
> > You can embed the image as a resource into a DLL assembly.
>
> > --
> > HTH,
>
> > Kevin Spencer
> > Chicken Salad Surgeon
> > Microsoft MVP
>
> > "bbrewder" wrote in message
>
> >news:1192656627.527692.52130@q3g2000prf.googlegroups.com...
>
> > >I am interested in hearing how other people have handled sharing
> > > resources in multiple projects (for example, a save icon).
>
> > > We have a product that has many forms within many projects. Many of
> > > these forms have a save button with an icon (along with other common
> > > buttons and icons). At this point, we've added the icon to each
> > > project.
>
> > > Unfortunately, if we want to change the icon, we now have to go to
> > > every project and change it. It would be nice if all the buttons used
> > > an icon from a shared resource assembly but I can't figure out how to
> > > enable something like that in the designer.
>
> > > Any ideas would be appreciated.- Hide quoted text -
>
> - Show quoted text -