using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; using System.Windows.Threading; namespace WPFProject.Controls { public partial class HolderForm : Form { private MaskControl maskPanel = new MaskControl { Dock = DockStyle.Fill, Visible = false }; public HolderForm() { InitializeComponent(); this.Controls.Add(maskPanel); } public object Content { get; private set; } public void UpdateChild(object content) { this.Content = content; if (content is Form form) { form.TopLevel = false; form.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; form.Dock = System.Windows.Forms.DockStyle.Fill; this.Controls.Clear(); this.Controls.Add(maskPanel); this.Controls.Add(form); form.Show(); } } public void ShowMask() { maskPanel.ShowLoad(this.Location, this.Size); } public void HideMask() { maskPanel.HideLoad(); } } }