Geo21800
Geo21800

Reputation: 13

Relocate form created inside a previous form

I have two form classes (IHM and HelpPanel). In my first loaded form (IHM) I call the function bHclass_Click to create and load a HelpPanel. The PopulatePCBclasses() function basically creates all the controls that will be displayed.

My issue is that this HelpPanel is always displayed at the exact same location no matter what value is input in it's Location property. I tried also by setting the Top and Left attributes but result was the same.

Do I miss an instruction?

private void bHclass_Click(object sender, EventArgs e)
{
    HelpPanel hp = new HelpPanel();
    hp.PopulatePCBclasses();
    hp.Location = new Point(10, 500);
    hp.Show();
}

Upvotes: 1

Views: 45

Answers (1)

Isma
Isma

Reputation: 15209

Try setting the start position as manual before changing the location:

private void bHclass_Click(object sender, EventArgs e)
{
    HelpPanel hp = new HelpPanel();
    hp.PopulatePCBclasses();
    hp.StartPosition = FormStartPosition.Manual;
    hp.Location = new Point(10, 500);
    hp.Show();
} 

Upvotes: 1

Related Questions