表单不应该像在Visual Basic .net中那样出现,一种表单在灰色(禁用)表单之后出现 [英] Forms not coming up like it should be in Visual Basic .net one form is coming after a greyed out (disabled) form

查看:89
本文介绍了表单不应该像在Visual Basic .net中那样出现,一种表单在灰色(禁用)表单之后出现的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,

我遇到以下问题,但看不到解决方案.
我创建了一个通过触摸屏使用的vb .net 2008程序.

有时会遇到的问题是,用户在触摸屏上滴答答答(我认为)是快速的,而窗口在彼此之上.

当他们单击一个选项时,我将显示一个新表单,并在此之后直接关闭旧表单,然后再执行其他操作.

像下面的命令.


我使用的FrmMain尺寸几乎全屏大.
在此主窗体上选择按钮时,请执行以下命令.

Hello,

I have the following problem where i dont see the solution.
I have created a vb .net 2008 programm that is used thru a touch screen.

The problem that is sometimes coming thru is that the users are ticking to fast (i think) on the touch screen and the windows are coming above eachother.

When they click a option , i show a new form and direct after this i close the old form befor doing something else.

like the commands below.


I use a FrmMain that is a big one in dimensions almost the full screen.
When selecting a button on this main form i do the following command.

FrmMain.enabled=false
FrmTest.show()



现在,在主窗体上有一个窗体(被禁用并显示为灰色的窗体).在这种新形式中,有一些选择.例如,当单击一个按钮时,使用"follwoing"命令执行账单总额.



Now there is a form on top of the mainform (the one that is disabled and greyed out). In this new form there are a few options. when clicking on a button for example Total of the bill is do the follwoing command.

FrmTotal.Show()
Me.Enabled = False



新窗口将显示要支付的总金额.当点击付费"时,我执行以下命令



The new windows comes up with a total amount to pay. When clicking on ''payed'' i do the following commands

me.close
frmtest.close()
frmmain.enabled=true
frmain.show()
frmmain.focus()




因此,就像tey可以在frm.total旁边单击,然后将frmmain设置在小frmtotal的顶部,因此由于在小字体顶部的frmmain,因此不再可能单击frmTotal上的按钮窗口.
我不知道这是可能的,因为frmmain仍然被禁用.


该程序位于错误的Windows位置,仅当使用鼠标单击正确的窗体时才能解决.

因为使用触摸屏,所以没有鼠标,因此没有连接键盘.

因此,该程序已被锁定,因为窗口位于它们必须单击的窗口之上.

有命令吗,所以我可以检查一下是否可以放进去


欢迎提出建议.

谢谢.


最好的问候


Didier




so it is like that tey can click next to the frm.total and so set the frmmain on top of the small frmtotal so it is not possible anymore to click on the button on the frmTotal because of the frmmain that is on top of the small window.
I dont understand this is possible since the frmmain is still disabled.


The program comes in a wrong windows position and can only be solved when using a mouse to click on the correct form.

Because the use of a touch screen there is no mouse , neither a keyboard is connected.

So the programm is locked because the windows is on top of the one they have to click.

Is there some comand so i can check that i can put in extra


Suggestions are most welcome.

Thanks.


best regards


Didier

推荐答案

1)我认为您需要更改执行操作的顺序以使其更具逻辑性.

2)还要看一下使用TopMost属性,该属性将调整窗口的zOrder.

3)首先使用hide属性,执行其他选项,然后关闭表单,最好保持关闭到最后.

请参阅下面的代码,以作为您上面想要做的事情的示例;
1) I think you need to change the order you perform the opertaions to make it more logical.

2) Also look at using the TopMost property which will adjust the zOrder of the windows.

3) Use the hide property first, perform the other options and then close the form, best to keep the close till last.

See the code below as example of what you are trying to do above;
Public Class FormMain

Private Sub ButtonShowTest_Click(sender As System.Object, e As System.EventArgs) Handles ButtonShowTest.Click
        Me.Enabled = False
        FormTest.Show()
        FormTest.TopMost = True
End Sub
End Class





Public Class FormTest

Private Sub ButtonShowPay_Click(sender As System.Object, e As System.EventArgs) Handles ButtonShowPay.Click
        Me.Enabled = False
        FormPay.Show()
        FormPay.TopMost = True
End Sub

Private Sub ButtonClose_Click(sender As System.Object, e As System.EventArgs) Handles ButtonClose.Click
        Me.Hide()
        FormMain.Enabled = True
        Me.Close()

End Sub
End Class





Public Class FormPay

Private Sub ButtonClose_Click(sender As System.Object, e As System.EventArgs) Handles ButtonClose.Click
    Me.Hide()
    FormTest.Enabled = True
    Me.Close()
End Sub
End Class


尝试更改代码位:使用ShowDialog而不是使用Show方法.不同之处在于,后者在表单关闭之前不会返回.这样,需要显示子表单的表单仍处于控制状态-子表单不需要了解较早的表单.

frmMain:
Try changing your code a bit: instead of using the Show method, use ShowDialog. The difference is that the later does not return until the form is closed. This way, the form that needs to show a sub form remains in control - the sub form does not need to know about the earlier ones.

frmMain:
me.Enabled = false
FrmTest.ShowDialog()
me.Enabled = true


frmTest:


frmTest:

me.Enabled = false
FrmTotal.ShowDialog()
me.Enabled = true
me.Close()


frmTotal:


frmTotal:

me.Close()


这样,可以更清楚地了解正在发生的事情,并且结构更好.您的问题应该消失了.


This way, it is clearer what is happening, and better structured. Your problem should disappear.


这篇关于表单不应该像在Visual Basic .net中那样出现,一种表单在灰色(禁用)表单之后出现的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆