1、可以使用ShowDialog()。ShowDialog()将其置于程序最顶层,而且不能使用当前程序的其它窗体。
2、可以设置Form.TopMost 属性为true,关于此属性的介绍:
Form.TopMost 属性
获取或设置一个值,指示该窗体是否应显示为最顶层窗体。
命名空间:System.Windows.Forms
程序集:System.Windows.Forms(在 system.windows.forms.dll 中)
参考代码与注释:
private void CreateMyTopMostForm()
{
// Create lower form to display.
Form bottomForm = new Form();
// Display the lower form Maximized to demonstrate effect of TopMost property.
bottomForm.WindowState = FormWindowState.Maximized;
// Display the bottom form.
bottomForm.Show();
// Create the top most form.
Form topMostForm = new Form();
// Set the size of the form larger than the default size.
topMostForm.Size = new Size(300,300);
// Set the position of the top most form to center of screen.
topMostForm.StartPosition = FormStartPosition.CenterScreen;
// Display the form as top most form.
topMostForm.TopMost = true;
topMostForm.Show();
}
两者二选一即可。