Is it possible to make a listbox that lists a bunch of custom controls? I would assume that you might have to invoke some sort of custom drawing of the child objects, but I do not know how to do that. Can anyone shed some light on this?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
A ListBox is not designed to be a container control. Its scrollbar cannot scroll the controls. It is in general something you want to avoid, putting a lot of controls in, say, a Panel whose AutoScroll property is True will make your UI unresponsive. Controls are expensive objects.
Take a look at the ListBox.DrawItem event. You can draw your own item and make it look just the way you want it with the Graphics class methods. And it is very cheap. There’s a very good example in the MSDN Library article for the event.