Title said it all.
im just wandering if there something i can use
in vb6 , a picture box can be used like a container
example. i can put textbox’s.. command buttons inside a picturebox.
thanks for any sudgestions ..
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.
The closest thing to VB6’s picturebox, in terms of its use as a container, would be the Panel. The Vb6 panel control was not very nice and I always used the picturebox, but the C# panel gives you almost everything VB6’s picturebox did, including background image. The main difference in your case is that the C# panel does not allow drawing on it. In other words, you can put pictures in it, but you can’t draw using Circle, Line, PSet etc.
Also have a look at your toolbox. Depending on what environment you’re working in, you might see your controls grouped under “Common Controls”, “Containers”, “Components”, etc. Look under “Containers” to see which controls can be used as containers.
You can also have other controls as containers, for example the picturebox. In the case of the Picturebox, you can make it the parent of your control during run-time. I think “MyControl.Parent = Picturebox1;” should work. But during design time, you cannot drop your control on the picturebox to make it the parent.
Lastly, you can create a custom control or a user control that acts as a container. As a quick example, I will show how to make a picturebox act as a container that you can drop controls on during design time.
Here I created a custom control, by creating a class that inherits from an existing control. I then make it behave like a design-time container by setting the appropriate attribute. I also had to add a couple of usings.
Now you can stick MyPicContainer on your form like any other control. It will behave just like a picturebox, because it is a picturebox, but at the same time it will behave like any other container control.
But unless you want to draw lines and circles on it during run-time, the control you’re looking for is the Panel.