C # Why is it not possible to set specific GUI actions in winform constructor?

I was wondering why it is not possible to set some properties in the winform constructor. For example, I have an extensible splitter (devcomponents library), and when I set the property Expandedto false, nothing happens in the constructor, but when I put the same code in the form load event, it works as expected. I put this code after the InitializeComponent () method.

Another situation, although a little different, is this. When you dynamically create combobox in a class and you set the selected index to another and then the first element, and then return this combo box, the selected index is set to 1 on the form.

Why is this?

Code snippet in the first situation (updated):

// This works in the form_load event but not in the form constructor (after InitializeComponent())
if (_tabId != -1)
{
    this.SuspendLayout();
    expandableSplitter1.SuspendLayout();

    expandableSplitter1.Expanded = false;
    expandableSplitter1.Enabled = false;

    // Hide all tabs, except the selected tab
    tabControl1.Tabs.Clear();

    QuestionTab tab = new QuestionTab(_tabId);

    TabItem tabItem = tabControl1.CreateTab(tab.Description);
    tabItem.Tag = tab;

    tabControl1.SelectedTabIndex = 0;

    TabItem_Click(tabItem, null);

    expandableSplitter1.ResumeLayout(true);
    this.ResumeLayout(true);
}

:

public Control GenerateList(Question question)
{
    // some code is omitted

    ComboBox cmb = new ComboBox();

    cmb.SuspendLayout();

    cmb.Name = "cmb";
    cmb.DisplayMember = "Answer";
    cmb.ValueMember = "Id";
    cmb.DataSource = answers;
    cmb.Dock = DockStyle.Top;

    cmb.SelectedValue = 3; // not the first index


    cmb.DropDownStyle = ComboBoxStyle.DropDownList;
    cmb.SelectedIndexChanged += new EventHandler(cmb_SelectedIndexChanged);

    cmb.ResumeLayout(true);

    return cmb;
}
+3
2

, . , , , , . , ( ).

, InitializeComponent(). - , Control.SuspendLayout(), Control.ResumeLayout(false).

, , (, TableLayoutPanel ), , this.SuspendLayout().

. () , , . . - , , .

Update

, , TabControl . ComboBox .

:

public partial class Form1 : Form
{
    public Form1()
    {
        InitializeComponent();

        tabControl1.SelectedIndex = 1;
        comboBox1.SelectedIndex = 2;
    }
}

( SuspendLayout() ResumeLayout()).

, OnLoad().

+1

, ExpandableSplitter true. DevComponents. InitializeComponent()?

, .

0

Source: https://habr.com/ru/post/1753292/