Reputation: 1
In a form I have a MenuStrip and a Webview2 component.
The MenuStrip does not close when you click on the Webview2 component.
I am unable to detect a mouse click using WebView2 in C# and so I cannot close the MenuStrip called menuStrip1.
Can I just simple use the event webView21_MouseDown ?
I have tried all kinds of solutions found on the internet but I cannot get it to work.
What am I missing?
using System;
using System.Windows.Forms;
using Microsoft.Web.WebView2.Core;
namespace TestWebView2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
InitializeWebview2();
}
private void Form1_Load(object sender, EventArgs e)
{
}
private async void InitializeWebview2()
{
await webView21.EnsureCoreWebView2Async(null);
}
private void webView21_MouseClick(object sender, MouseEventArgs e)
{
MessageBox.Show("it does not work");
}
private void webView21_MouseDown(object sender, MouseEventArgs e)
{
MessageBox.Show("it does not work");
}
}
}
The MenuStrip does not close when you click on the Webview2 component.
Upvotes: 0
Views: 389