Share image resources between projects

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • bbrewder

    #1

    Share image resources between projects

    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.

  • Kevin Spencer

    #2
    Re: Share image resources between projects

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

    --
    HTH,

    Kevin Spencer
    Chicken Salad Surgeon
    Microsoft MVP

    "bbrewder" <bbrewder@gmail .comwrote in message
    news:1192656627 .527692.52130@q 3g2000prf.googl egroups.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.
    >

    Comment

    • CassioT

      #3
      Re: Share image resources between projects


      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" <unclechut...@n othinks.comwrot e:
      You can embed the image as a resource into a DLL assembly.
      >
      --
      HTH,
      >
      Kevin Spencer
      Chicken Salad Surgeon
      Microsoft MVP
      >
      "bbrewder" <bbrew...@gmail .comwrote in message
      >
      news:1192656627 .527692.52130@q 3g2000prf.googl egroups.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.

      Comment

      • bbrewder

        #4
        Re: Share image resources between projects

        I ended up creating a resource assembly, using the resource generator
        from Code Project (http://www.codeproject.com/dotnet/
        ResXFileCodeGen eratorEx.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 <cass...@gmail. comwrote:
        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" <unclechut...@n othinks.comwrot e:
        >
        >
        >
        You can embed the image as a resource into a DLL assembly.
        >
        --
        HTH,
        >
        Kevin Spencer
        Chicken Salad Surgeon
        Microsoft MVP
        >
        "bbrewder" <bbrew...@gmail .comwrote in message
        >
        news:1192656627 .527692.52130@q 3g2000prf.googl egroups.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 -

        Comment

        Working...