Sizing form/tabcontrol/panel

I have a form, which contains a tabcontrol, which then has a tabpage. The tabpage contains a tablelayoutpanel with some buttons and labels in it.

When I load my program, the form shows the tabpage, which is much smaller than the form, and only has about half of the panel displayed. I've been trying to google around, but despite what I do, I cannot get the form to size to the tabpage/tabcontrol to size to the panel.

partial class PrimaryForm{ private void InitializeComponents() { tabController = new TabControl(); charTab = new TabPage(); resultsTab = new TabPage(); Panel selectPanel = new SelectionPanel(systemComboBoxFill()); charTab.Controls.Add(selectPanel);

 charTab.Text = "Characters"; resultsTab.Text = "Initiative Order"; tabController.Controls.Add(charTab); tabController.Controls.Add(resultsTab); this.Text = "Initiative Tracker"; this.Controls.Add(tabController); } 


class SelectionPanel : TableLayoutPanel { //creates primary buttons private Button newChar; private Button rollInit; private Button clearInit;

 //creates labels for everything private Label creatureName; private Label initBonus; private Label initLock; private Label fixedInit; private ComboBox systemSelBox; public SelectionPanel(String[] systemList) { this.RowCount = 2; this.ColumnCount = 4; newChar = new Button(); rollInit = new Button(); clearInit = new Button(); creatureName = new Label(); initBonus = new Label(); initLock = new Label(); fixedInit = new Label(); systemSelBox = new ComboBox(); //devs newChar newChar.Text = "New Character"; rollInit.Text = "Roll Initiative"; clearInit.Text = "Clear Initiative"; creatureName.Text = "Creature Name:"; initBonus.Text = "Initiative Bonus:"; initLock.Text = "Init Lock:"; fixedInit.Text = "Fixed Initiative:"; systemSelBox.Items.AddRange(systemList); systemSelBox.SelectedIndex = 0; this.Controls.Add(newChar, 0,0); this.Controls.Add(rollInit, 1,0); this.Controls.Add(clearInit, 2, 0); this.Controls.Add(systemSelBox, 3, 0); this.Controls.Add(creatureName, 0,1); this.Controls.Add(initBonus,1,1); this.Controls.Add(initLock,2,1); this.Controls.Add(fixedInit, 3, 1); } } 

by Kipple_Snacks via /r/csharp

Leave a Reply