我正在使用此代码块将其他Form1显示为对话框
private void ShowDialogWindow<T>() where T : Form,new()
{
Cursor.Current = Cursors.WaitCursor;
using (Form form = new T())
{
form.ShowDialog(this);
}
}
ShowDialogWindow<Form1>();// loads form1 as a dialog form
下面的代码是一种透明的无边界表单,当子表单处于活动状态时,它将为父表单添加透明效果
命名空间PopupEffect {
public partial class transparentBg : Form
{
public transparentBg(Form parent,Form child)
{
InitializeComponent();
_child = child;
this.Location = parent.Location;
this.Size = parent.Size;
this.ShowDialog();
}
public transparentBg(Form child)
{
InitializeComponent();
_child = child;
this.windowstate = Formwindowstate.Maximized;
this.ShowDialog();
}
_ = new PopupEffect.transparentBg(this,new Form1());//add the fade effect to the parent form when the child form is active
如何将透明代码块添加到此ShowDialogWindow()