using Microsoft.Office.Interop.Word; using Microsoft.Web.WebView2.Core; using System; using System.Windows.Forms; namespace AIProofread.Controls { public partial class ProofreadMainControl : UserControl { private Document doc; private int minWidth; public ProofreadMainControl(Document doc,int minWidth) { InitializeComponent(); this.doc = doc; this.minWidth = minWidth; Bridge.InitWebEnvAsync("main", web); } private void ProofreadMainControl_Load(object sender, EventArgs e) { this.web.Source = new Uri(Config.WebPath("#home?version=" + Config.APP_VERSION)); //this.SizeChanged += ProofreadMainControl_SizeChanged; } private void ProofreadMainControl_SizeChanged(object sender, EventArgs e) { if(this.minWidth > 0 && this.Width < this.minWidth) { SendKeys.Send("{ESC}"); this.Width = this.minWidth; } } } }