多形式问题。 [英] Multiple Form Problem.

查看:60
本文介绍了多形式问题。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在研究多种形式。我有一个textBox,当用户点击textBox时会显示一个新表单(实际上是我自己开发的屏幕键盘)。我想使用自己的屏幕键盘在TextBox上键入字符。现在,当显示新表单时,textBox将被禁用。但是,我使用的是非模态形式。

解决方案

如果您使用 myNewForm.ShowDialog()要显示表单,那么它确实会禁用父表单 - 因为ShowDialog打开一个模态表单。请改用 myNewForm.Show(),它不会。



我建议你也想要在父表单中处理新表单FormClosing事件以防止打开多个副本,如果您希望立即处理键,您应该查看从您的键盘表单提供父级可以处理和处理的事件。这并不困难,请看这里:在两个表格之间传递信息,第2部分:儿童到家长 [ ^ ]

I am working on multiple forms. I have a textBox, and when the user click on the textBox a new form is shown (which is actually my own developed on-screen keyboard). I want to type characters on the TextBox using my own on-screen keyboard. Right now, when the new form is displayed, the textBox becomes disabled. However, I'm using non-modal forms.

解决方案

If you are using myNewForm.ShowDialog() to display the form, then it will indeed disable the "parent" form - because ShowDialog opens a modal form. Use myNewForm.Show() instead, and it won't.

I would suggest that you also want to handle the new form FormClosing event in the parent form to prevent multiple copies being opened, and if you want the "keys" processed immediately, you should look at providing events from your keyboard form which the parent can handle and deal with appropriately. It's not difficult, see here: Transferring information between two forms, Part 2: Child to Parent[^]


这篇关于多形式问题。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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