如何创建一个无模式消息框?我是否必须创建自己的 Windows 窗体类并使用它?如果是这样,是否有一种简单的方法来添加警告图标(而不是插入我自己的图像)并根据文本量调整大小?
如果您需要一个在代码继续在后台运行时自动显示的消息框(该框仍然是模态的,并且将阻止用户使用其他窗口,直到单击“确定”),您始终可以在其自己的线程中启动该消息框并继续做你在原始线程中所做的事情:
// Do stuff before.
// Start the message box -thread:
new Thread(new ThreadStart(delegate
{
MessageBox.Show
(
"Hey user, stuff runs in the background!",
"Message",
MessageBoxButtons.OK,
MessageBoxIcon.Warning
);
})).Start();
// Continue doing stuff while the message box is visible to the user.
// The message box thread will end itself when the user clicks OK.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)