diff --git a/.vs/AIProofread/v17/.suo b/.vs/AIProofread/v17/.suo index 1c166b3..e4c1dea 100644 Binary files a/.vs/AIProofread/v17/.suo and b/.vs/AIProofread/v17/.suo differ diff --git a/AIProofread/Bridge.cs b/AIProofread/Bridge.cs index dde95d1..499a03c 100644 --- a/AIProofread/Bridge.cs +++ b/AIProofread/Bridge.cs @@ -58,6 +58,11 @@ namespace AIProofread System.Windows.Forms.MessageBox.Show(message); } + public int getMinWIdth() + { + return Globals.ThisAddIn.GetMinWidth(); + } + /// /// 添加事件 /// diff --git a/AIProofread/Controls/ProofreadMainControl.Designer.cs b/AIProofread/Controls/ProofreadMainControl.Designer.cs index da3ed80..0df2fd2 100644 --- a/AIProofread/Controls/ProofreadMainControl.Designer.cs +++ b/AIProofread/Controls/ProofreadMainControl.Designer.cs @@ -29,6 +29,7 @@ private void InitializeComponent() { this.web = new Microsoft.Web.WebView2.WinForms.WebView2(); + this.label1 = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.web)).BeginInit(); this.SuspendLayout(); // @@ -46,21 +47,34 @@ this.web.TabIndex = 0; this.web.ZoomFactor = 1D; // + // label1 + // + this.label1.AutoSize = true; + this.label1.Location = new System.Drawing.Point(175, 590); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(41, 12); + this.label1.TabIndex = 0; + this.label1.Text = "校对王"; + this.label1.Visible = false; + // // ProofreadMainControl // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; + this.Controls.Add(this.label1); this.Controls.Add(this.web); this.Name = "ProofreadMainControl"; this.Size = new System.Drawing.Size(400, 800); this.Load += new System.EventHandler(this.ProofreadMainControl_Load); ((System.ComponentModel.ISupportInitialize)(this.web)).EndInit(); this.ResumeLayout(false); + this.PerformLayout(); } #endregion public Microsoft.Web.WebView2.WinForms.WebView2 web; + private System.Windows.Forms.Label label1; } } diff --git a/AIProofread/Controls/ProofreadMainControl.cs b/AIProofread/Controls/ProofreadMainControl.cs index 4815968..a9eb303 100644 --- a/AIProofread/Controls/ProofreadMainControl.cs +++ b/AIProofread/Controls/ProofreadMainControl.cs @@ -20,7 +20,7 @@ namespace AIProofread.Controls private void ProofreadMainControl_Load(object sender, EventArgs e) { - this.web.Source = new Uri(Config.WebPath("#home?version=" + Config.APP_VERSION)); + this.web.Source = new Uri(Config.WebPath("home?version=" + Config.APP_VERSION + "&t=" + DateTime.Now.Ticks)); //this.SizeChanged += ProofreadMainControl_SizeChanged; } @@ -32,5 +32,9 @@ namespace AIProofread.Controls this.Width = this.minWidth; } } + public int LabelWidth() + { + return label1.Width; + } } } diff --git a/AIProofread/ThisAddIn.cs b/AIProofread/ThisAddIn.cs index cc6e486..6e328e0 100644 --- a/AIProofread/ThisAddIn.cs +++ b/AIProofread/ThisAddIn.cs @@ -23,7 +23,7 @@ namespace AIProofread /// /// 最小宽度 /// - private const int MinWidth = 420; + public static int MinWidth = 0; /// /// 启动路径 /// @@ -147,14 +147,17 @@ namespace AIProofread //proofreadPanel = new ProofreadMainControl(); var control = new ProofreadMainControl(doc, MinWidth); + if (MinWidth < 10) + { + MinWidth = 420 * control.LabelWidth() / 42; + } var panel = Globals.ThisAddIn.CustomTaskPanes.Add(control, AddinName); this.currentDocumentTaskPane = panel; taskPanels.Add(doc, panel); - control.Width = MinWidth; - panel.Width = MinWidth; panel.Visible = false; panel.VisibleChanged += Panel_VisibleChanged; - + control.Width = MinWidth; + panel.Width = MinWidth; // 监听尺寸变化 防止最小尺寸小于设置值 control.SizeChanged += Control_SizeChanged; return panel; @@ -185,6 +188,11 @@ namespace AIProofread } } + public int GetMinWidth() + { + return MinWidth; + } + public void Send(SendOrPostCallback d) { FmainThreadContext.Send(d, null); diff --git a/AIProofread/obj/Debug/AIProofread.csproj.AssemblyReference.cache b/AIProofread/obj/Debug/AIProofread.csproj.AssemblyReference.cache index 411971b..cd4c4b6 100644 Binary files a/AIProofread/obj/Debug/AIProofread.csproj.AssemblyReference.cache and b/AIProofread/obj/Debug/AIProofread.csproj.AssemblyReference.cache differ diff --git a/AIProofread/obj/Debug/AIProofread.csproj.GenerateResource.cache b/AIProofread/obj/Debug/AIProofread.csproj.GenerateResource.cache index b226628..e5754cb 100644 Binary files a/AIProofread/obj/Debug/AIProofread.csproj.GenerateResource.cache and b/AIProofread/obj/Debug/AIProofread.csproj.GenerateResource.cache differ diff --git a/AIProofread/obj/Debug/AIProofread.dll b/AIProofread/obj/Debug/AIProofread.dll index 3b97bb1..a4df31a 100644 Binary files a/AIProofread/obj/Debug/AIProofread.dll and b/AIProofread/obj/Debug/AIProofread.dll differ diff --git a/AIProofread/obj/Debug/AIProofread.pdb b/AIProofread/obj/Debug/AIProofread.pdb index 1fdea6b..4e67dce 100644 Binary files a/AIProofread/obj/Debug/AIProofread.pdb and b/AIProofread/obj/Debug/AIProofread.pdb differ diff --git a/AIProofread/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/AIProofread/obj/Debug/DesignTimeResolveAssemblyReferences.cache index 863b494..1dddad4 100644 Binary files a/AIProofread/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/AIProofread/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ