I reproduced this problem, and after my testing, this problem only occurs when we use the Form.ShowDialog() Method.
Consider modifying it to the Form.Show() method.
private void button1_Click(object sender, EventArgs e)
{
Form2 form2 = new Form2(this,@"pdfPath");
form2.Show();
this.Visible = false;
}
Code in Form2:
private Form form1;
private string pdfPath;
public Form2(Form form, string path)
{
InitializeComponent();
form1 = form;
pdfPath = path;
}
private void Form2_Load(object sender, EventArgs e)
{
webView21.Source = new Uri(pdfPath);
this.FormClosing += Form2_FormClosing;
}
private void Form2_FormClosing(object sender, FormClosingEventArgs e)
{
form1.Visible = true;
}
If the response is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.