我正在创建一个C# WinForms MDI应用程序。我有一个主窗体,其中包含4个其他窗体。我希望能够将子窗体移动到父窗体之外(它们的FormBorderStyle值设置为大小可调节的工具栏,以便每个子窗口不会在任务栏上出现单独的窗口)。我可以通过使用以下代码来实现主窗体:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace Prototype
{
public partial class MdiParent : Form
{
private FastEyeControl m_ControlForm;
private FastEyeLogWindow m_LogForm;
private FastEyeConfiguration m_ConfigurationForm;
private ROCOrderWindow m_OrderLogForm;
public MdiParent()
{
InitializeComponent();
m_ControlForm = new FastEyeControl();
m_LogForm = new FastEyeLogWindow();
m_ConfigurationForm = new FastEyeConfiguration();
m_OrderLogForm = new ROCOrderWindow();
}
private void MdiParent_Load(object sender, EventArgs e)
{
m_ControlForm.Show(this);
m_LogForm.Show(this);
m_ConfigurationForm.Show(this);
m_OrderLogForm.Show(this);
}
}
}
然而,当我最小化父窗体时,所有子窗体也会被最小化(如预期)。有没有办法防止任何在父窗口之外的子窗体在父窗口最小化时被最小化?基本上,如果需要,我希望用户能够调整大小和移动单独的子窗体到父窗体之外(就像在Visual Studio.NET中取消停靠工具栏并将其放置在其他监视器中一样)。感谢您的帮助!