简体   繁体   English

两个控件先于其他控件

[英]Two controls show before the others

I have on a form a UserControl that I use as a Data-Entry form. 我在一个窗体上有一个UserControl,用作数据输入窗体。 I show and hide it constantly with new data. 我用新数据不断显示和隐藏它。

Often (not all the times) the same two memo-boxes are shown on the screen first for a second, and then the full control is visible. 通常(并非始终),相同的两个备注框会先显示在屏幕上一秒钟,然后才能看到完整的控件。

I found this link, I'm not sure if that's my solution, but in any case I don't know where to call it and when. 我找到了链接,我不确定这是否是我的解决方案,但是无论如何我都不知道在哪里调用它以及何时调用它。

EDIT: I noticed that it happens 'only' if the program is idle for a couple of minutes. 编辑:我注意到,仅当程序空闲几分钟后,它才会“发生”。 I could show and hide the control 10 times one after the other no problem. 我可以一个接一个地显示和隐藏控件十次,没问题。 but if I hide it and show it again after 2-3 minutes then I get this behavior. 但是,如果我将其隐藏并在2-3分钟后再次显示,则会出现这种情况。

I guess it has to do with the time it takes to reconnect to the MsSQL database to pull the data. 我想这与重新连接到MsSQL数据库提取数据所需的时间有关。 But how can I tell this 2 boxes to stay invisible like there parent until the parent is ready to show? 但是我怎么能告诉这两个盒子像父母一样保持隐形,直到父母准备展示呢?

This is really sloppy and there is probably a better solution but what if you tried something like this. 这真的很草率,可能有更好的解决方案,但是如果您尝试这样的话该怎么办。

If SlowControl.visible = True Then
FastControl1.visible = True
FastControl2.visible = True
End If

I'm not sure if that will work since i don't know how to replicate the problem to test but try it out and see if it delays the 2 that are ahead of the game a bit and doesn't show them until the others show. 我不确定这是否行得通,因为我不知道该如何复制该问题进行测试,但请尝试一下,看看它是否会延迟游戏中领先的2并在其他游戏之前不显示它们节目。

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

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