来自tabPage的MessageBox [英] MessageBox from tabPage
问题描述
我正在尝试显示一个消息框,当它从tabPage点击提交按钮时显示一个Ok按钮:
I'm trying to display a messagebox that shows an Ok button upon hitting Submit button from a tabPage:
MessageBox.Show(新的Form(){TopMost = true},"名称必须填写。";
MessageBox.Show(new Form() {TopMost = true}, "Name must be filled.");
除了我希望它显示在形式的中间。 提交按钮是父tabControl的子项。
besides that I wanted it to show in the middle of the form. The Submit button is a child of the parent tabControl.
推荐答案
不是一个非常明确的问题。但是,当你执行MessageBox.show时,它总是显示在屏幕的中心。所以,低于一个就足够了。
Not a very clear question. But, when you do MessageBox.show, it's always shown at the center of the screen. So, below one is sufficient.
MessageBox.Show("Name must be filled");
另一方面,如果你想在表单中间显示messageBox,那么我建议你创建自己的MessageBox并手动设置大小和位置然后显示它。
On the other hand, if you want to show the messageBox in the middle of the form, then I suggest you to create your own MessageBox and set the size and location manually and then show it.
我希望这会有所帮助。
这篇关于来自tabPage的MessageBox的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!