这是上下文:
//Form
//Popup modal Form
//Messagebox
MessageBox
代码:
DialogResult oResult = AppMessageBox.Show(this, "Replace the existing codes?",
MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
AppMessageBox
类并不特别:
public class AppMessageBox
{
private static String _strName;
private static String strName
{
get
{
if (_strName == null)
{
_strName = System.Reflection.Assembly.GetExecutingAssembly().GetName().Name;
}
return _strName;
}
}
public static DialogResult Show(String strMessage, MessageBoxButtons buttons = MessageBoxButtons.OK, MessageBoxIcon icon = MessageBoxIcon.Information)
{
return MessageBox.Show(strMessage, strName, buttons, icon);
}
public static DialogResult Show(IWin32Window hWndOwner, String strMessage, MessageBoxButtons buttons = MessageBoxButtons.OK, MessageBoxIcon icon = MessageBoxIcon.Information)
{
return MessageBox.Show(hWndOwner, strMessage, strName, buttons, icon);
}
}
显示消息框的代码从表单的按钮处理程序中调用。然而,它显示在屏幕的中央,而不是内部形式的核心。为什么呢?
我想如果我通过"这"它会将其置于当前形式的中心。