|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Re: Share one common imagelist amongst many formsclass MyImageLists { private static ImageList imageList1 = new ImageList(); static MyImageLists() { // code to init imageList1 } public static ImageList ImageList1 { get { return imageList1; } } } Then in your form, you can do (for example): myListView.ImageList = MyImageLists.ImageList1; I use a similar technique for all of my shared images. 1 Images class with static accessors to the images. Works like a champ. :=) Show quote > I'm writing an app in vb.net 1.1 and would like to share one common > imagelist amongst many forms. Is there a way to do this? Perhaps put > the image list in a component and then have each form create an > instance of this component. What are some recommendations for this? > I know I could put it on a base form and inherit from that which I do > for some other images, but in this case I want to be able to choose > from a few different common image lists. > > Thanks. > Thanks! Look like what I was looking for.
-- Show quotemoondaddy@nospam.com "Matt Berther" <mbert***@hotmail.com> wrote in message news:6188713632366656228495186@news.microsoft.com... > Hello moondaddy, > > class MyImageLists > { > private static ImageList imageList1 = new ImageList(); > static MyImageLists() > { > // code to init imageList1 } > > public static ImageList ImageList1 { get { return imageList1; } } } > > Then in your form, you can do (for example): > > myListView.ImageList = MyImageLists.ImageList1; > > I use a similar technique for all of my shared images. 1 Images class with > static accessors to the images. Works like a champ. :=) > > -- > Matt Berther > http://www.mattberther.com > >> I'm writing an app in vb.net 1.1 and would like to share one common >> imagelist amongst many forms. Is there a way to do this? Perhaps put >> the image list in a component and then have each form create an >> instance of this component. What are some recommendations for this? >> I know I could put it on a base form and inherit from that which I do >> for some other images, but in this case I want to be able to choose >> from a few different common image lists. >> >> Thanks. >> > > |
|||||||||||||||||||||||