简体   繁体   English

不同的设计时/运行时WinForms控件行为

[英]Different design time/Runtime WinForms control behaviour

I am building an app that uses some built in and some 3rd party controls (DevExpress). 我正在构建一个使用一些内置控件和一些第三方控件(DevExpress)的应用程序。

Inside the designer, everything looks OK, however while running the app, some controls are placed wrong. 在设计器内部,一切看起来都不错,但是在运行应用程序时,某些控件放置有误。

Are there any easy ways to debug this issue? 有没有简单的方法可以调试此问题?

More specifically, i have a container that holds 2 controls in it. 更具体地说,我有一个包含2个控件的容器。 These controls should stack nicely together one on top of the other (indeed it looks like that in the Designer). 这些控件应该很好地堆叠在一起(实际上看起来就像在Designer中那样)。

While running the app, one control is displayed on top of the other blocking it (see attached image). 运行该应用程序时,一个控件会显示在另一个控件的上方,从而阻止了该控件(请参见附件的图像)。 在此处输入图片说明

Another weird thing is that some properties of the 2 controls that get overlapped are not updated with respect to their visual status. 另一个奇怪的事情是,重叠的2个控件的某些属性并未根据其视觉状态进行更新。

this means that a control has a Location of (0, 300) but in fact appears to be in (0, 0). 这意味着控件的位置为(0,300),但实际上似乎位于(0,0)中。

As a workaround, you could place the two controls in the two panels of a SplitContainer and dock (fill) them there. 解决方法是,您可以将两个控件放在SplitContainer的两个面板中,然后将其停靠(填充)到那里。 This has also the advantage that the users can resize the controls. 这也具有用户可以调整控件大小的优点。

Another alternative is the TableLayoutPanel . 另一种选择是TableLayoutPanel

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM