C# PIctureBox位置在运行时未对齐

C# PIctureBox位置在运行时未对齐,c#,winforms,runtime,parent-child,picturebox,C#,Winforms,Runtime,Parent Child,Picturebox,我有一个Windows窗体应用程序,在designer中,所有内容都按照我希望的方式排列。我已经圈出了麻烦的部分,虽然其他部分似乎也发生了变化,但这一部分是重要的 这是设计器模式下的视图。 我编译,运行,最后得到了类似的结果,但是没有对齐 这就是它在运行时。 我不明白为什么会发生这种情况,我想知道是否有人能解释这一点 哦,这可能与此有关,但我不明白为什么会这样。这是对代码的最新更改,可能会影响它这样做,但我不明白它会如何。不过,我会提供代码 // add the auxilary pictu

我有一个Windows窗体应用程序,在designer中,所有内容都按照我希望的方式排列。我已经圈出了麻烦的部分,虽然其他部分似乎也发生了变化,但这一部分是重要的

这是设计器模式下的视图。

我编译,运行,最后得到了类似的结果,但是没有对齐

这就是它在运行时。

我不明白为什么会发生这种情况,我想知道是否有人能解释这一点

哦,这可能与此有关,但我不明白为什么会这样。这是对代码的最新更改,可能会影响它这样做,但我不明白它会如何。不过,我会提供代码

// add the auxilary pictureboxes as a component of the bg picture box to enable transparency
pictureBoxBattleBG.Controls.Add(panelOppPokemon);
pictureBoxBattleBG.Controls.Add(panelPokemon);
pictureBoxBattleBG.Controls.Add(pictureBoxOppPokemon);
pictureBoxBattleBG.Controls.Add(pictureBoxPokemon);
pictureBoxBattleBG.Controls.Add(pictureBoxTime);

// do the same with the time overlay
pictureBoxTime.Controls.Add(pictureBoxTimeOfDay);

试着把00:00pm的盒子从下面一个一个地移开,这样它们就不会互相重叠了。要查看问题在哪里,请检查picturebox的锚属性。它应该是左+上选择的。标签没有弄乱,但这可能是因为我没有将它设置为更大控件的子控件。另外,默认的锚点属性是Top,Left,我没有弄乱它。