简体   繁体   English

将控件添加到消息框?

[英]Add controls to a messagebox?

Is it possible to add buttons or maybe other controls to an existing message box? 是否可以在现有消息框中添加按钮或其他控件? It would be very use full instead of making a form. 完全不用填写表格就可以使用。 If it's not possible for an existing message box, is it possible to make a new component like that? 如果不可能使用现有的消息框,是否可以制作这样的新组件?

PS: I'm using win forms. PS:我使用的是获胜表格。 And I know that you can add the yes/no buttons. 而且我知道您可以添加是/否按钮。 Like this: 像这样:

DialogResult dialogResult = MessageBox.Show("Sure", "Some Title",MessageBoxButtons.YesNo);
if(dialogResult == DialogResult.Yes)
{
    //do something
}
else if (dialogResult == DialogResult.No)
{
    //do something else
}

Thanks already! 已经谢谢你了!

Well , the answer you are looking for is NO. 好吧 ,您正在寻找的答案是否定的。 It is not possible to add other controls to MessageBox . 无法将其他控件添加到MessageBox If the current MessageBoxButtons enum doesn't provide you with your required buttons then you have no other option then to make your own, using a standard Form or a UserControl . 如果当前的MessageBoxButtons枚举没有为您提供所需的按钮,则您别无选择,只能使用标准FormUserControl

You may see : Custom Message Box in VC# as a starting point. 您可能会看到: VC#中的“ 自定义消息框”作为起点。

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

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