Here is a picture of what I'm trying to say:
You can see in the picture that I want to make a template and multiply it in my application. I came up with an idea that put the controls in a panel and multiply the panel with code, but the constructor of the panel wouldn't allow me to do that. Is there any other way I can multiply it cause I can't drag and drop all the controls into the form? Thank you in advance.
You can create a UserControl
and draw your Template inside the UserControl
.
Then on the MainForm, you can use a LayoutPanel
and dynamically instantiate your UserControl
and add it to the Controls
Collection of the LayoutPanel
.
Step1 Create a new UserControl(say ucTemplate), and add the picture box & labels in it.
Step2 In the Main Form: Add a new LayoutPanel(or a simple Panel.
And whenever you want to repeat your template, simply call the addTemplate()
method.
Public sub addTemplate()
Dim ucTemplate = new ucTemplate()
ucTemplate.Dock = Dock.Top
LayoutPanel1.Controls.add(ucTemplate)
End sub
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With