Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / December 2004

Tip: Looking for answers? Try searching our database.

Share one common imagelist amongst many forms

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
moondaddy - 20 Nov 2004 05:55 GMT
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.

Signature

moondaddy@nospam.com

Matt Berther - 22 Nov 2004 03:26 GMT
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
[quoted text clipped - 5 lines]
>
> Thanks.
moondaddy - 06 Dec 2004 20:11 GMT
Thanks!  Look like what I was looking for.

Signature

moondaddy@nospam.com

> Hello moondaddy,
>
[quoted text clipped - 27 lines]
>>
>> Thanks.

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.