如何在C#中显示对话框形式

我正在使用此代码块将其他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()

lyc417402731 回答:如何在C#中显示对话框形式

暂时没有好的解决方案,如果你有好的解决方案,请发邮件至:iooj@foxmail.com
本文链接:https://www.f2er.com/3157926.html

大家都在问