Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi all,

 

Normally I use VB just trying to write something in C# at the moment (not that this is the problem)

 

I was creating a user control for a 'log entry' (basically a panel with labels in and a picture box) this then displays a summery of information on a 'log' and the picture box shows an image that helps denote the status.

 

My question is if I was to include all the 6 icons I have made (that cover all my status permutations) in my control and then create an array of these new controls in an application�

 

(The idea being that I then just have to change my status property of the control and it would display the appropriate icon and the correct text etc.)

 

Would the system use the same images or would it be using lots of memory to store all the images in all the controls?

 

And what is the best way of doing this?

 

 

Thanks,

The Red Duke

  • Leaders
Posted

I have been wondering about this myself. If the pictures are stored, say, in PictureBoxes, I beleived that the images would need to be loaded and instantiated from the app's embedded resources for each instance of the control, and hence duplicated.

 

No guarantees, but if you create a shared ImageList and load your images into the ImageList (via a shared constructor) and then set your PictureBox's .Picture property to the images from the ImageList, I believe that all six images could be shared between instances. But... I wouldn't know exactly how to do this.

[sIGPIC]e[/sIGPIC]

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...