views:

927

answers:

2

What is more lightweight control, a label, or a picturebox? (label can contain image too).

I will have a form with 110 icons displayed in separate controls and I'm deciding if I should display them in pictureboxes, or a labels.

In VB6, there was an Imagebox control which was MUCH more lightweight than picturebox. What is the most similar control to Imagebox in VB.NET?

Thanks! :-)

A: 

I don't think you can compare them because fundamentally they are so different--VB6 controls versus .net framework controls that is.

Take a look at the class hierarchy in .net and you will see that both picturebox and label derive from the same set of classes.

While I didn't itemize the classes' properties and methods, I would guess that the only difference between a Label and a Picturebox is that there is a text property for a Label box thus alleviating you of rendering your own text if there were no Label control and all you had was a PictureBox.

Both a Label and a PictureBox can be assigned an Image object or work in conjunction with an ImageList. So if all you are looking to do is display images then the PictureBox should be just fine (not to mention the fact that it clearly conveys the control's purpose in life: PictureBox:Icons::Label:Text).

Bill
+1  A: 

Although I know it's not part of your question, the real problem it seems you are experiencing is the fact that you have 110 icons in a single form. I would take a look at the UI and see if there is a better way to lay it out or design it so you don't have to worry about whether or not to use one component vs the other.

JasCav
It's form for icon selection, so there is no real alternative. The only alternative is to use a component for icon selection. I'm not aware of any useful control like that.
Jiri
I was more suggesting that you don't put 110 icons on a form and instead maybe create a different way of accessing your UI. (Drill down into the GUI, don't always use icons, etc.)
JasCav