Reputation: 321
Here is the code:
Private WithEvents modderInfoGroup As New NSGroupBox
modderInfoGroup.Text = ""
modderInfoGroup.Location = New Point(3, 3)
modderInfoGroup.Size = New Size(512, 424)
modderInfoGroup.DrawSeperator = True
modderInfoGroup.Title = currentModder
modderInfoGroup.SubTitle = "Modder Information"
modderInfoGroup.Anchor = AnchorStyles.Top Or AnchorStyles.Left Or AnchorStyles.Bottom Or AnchorStyles.Right
myTabPage.Controls.Add(modderInfoGroup)
myTabPage.Name = "modder" & modderNumber
When creating the Control dynamically is defaults to Top and Left but i want it to set it to all 4 edges. Anyone got a fix?
This is a Windows Form(WinForm) in Visual Studio 2015.
Upvotes: 1
Views: 261
Reputation: 81675
If you are trying to fill the space of the container control, then the property you want to set is the Dock property:
modderInfoGroup.Dock = DockStyle.Fill
The anchor property was working, but the initial size didn't match the size of the client area of the parent control. To make that work, you would have to set the size to that client size:
modderInfoGroup.Location = Point.Empty
modderInfoGroup.Size = MyTabPage.ClientSize
Upvotes: 2