Application repository

  • Thread starter Thread starter Peter Morris
  • Start date Start date
P

Peter Morris

Hi all

This is a single example scenario, there are many more scenarios which could
require the same thing.

I have a custom-made ImageList component which holds many images of varying
sizes. I then have custom-made controls which use this ImageList to display
their own appearances. The images are in an ImageList because many controls
would need to share the same images, however, there seems to be no way to
achieve the same thing across different forms.

It would obviously be better to have a single "repository" in the app which
all of these custom controls could refer to in order to avoid having the
same images loaded per form. As the controls require the images in order to
be displayed properly at design-time, it would also be necessary to specify
the image list at design-time so that I can see what I am doing.

Any suggestions?


--
Pete
=============
Read or write technical articles
http://www.HowToDoThings.com

-There are 10 types of people in the world, those who understand binary, and
those who don't
 
Sounds like you want a singleton with design time support. Ew. ;)

There are a number of possibilities open to you I think. First up, since you
seem quite adept at writing controls and components, why not create a
component (non visual) that references an external file of your images. This
file can be encrypted or otherwise generally munged about to prevent the
outside world taking a peek in. Then devise a small application to build
that file at design time.

Another alternative would be to delve into the arcane world of resource
files. Write a component that does have a design time view which updates the
applications main resource file. The resource file itself, by it's very
nature, is a singleton, so you essentially end up with many instances of a
control all pointing to a single data repository of your images. You could
probably sell that one ;)

Hyopthetically (as in, I haven't tried this) create a form that hosts your
image list, and build the image list. At runtime, create the form hidden,
then have code clone the hidden image list. On second thoughts, no - that's
horrible.

I think your best bet is the custom control with resource files route. Good
luck


--
Peter Wright
Author of ADO.NET Novice To Pro, from Apress Inc.


_____________________________
 
Back
Top