根据设备自动计算宽度
This commit is contained in:
parent
98885c3aef
commit
a03a5f4348
Binary file not shown.
@ -58,6 +58,11 @@ namespace AIProofread
|
|||||||
System.Windows.Forms.MessageBox.Show(message);
|
System.Windows.Forms.MessageBox.Show(message);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int getMinWIdth()
|
||||||
|
{
|
||||||
|
return Globals.ThisAddIn.GetMinWidth();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 添加事件
|
/// 添加事件
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -29,6 +29,7 @@
|
|||||||
private void InitializeComponent()
|
private void InitializeComponent()
|
||||||
{
|
{
|
||||||
this.web = new Microsoft.Web.WebView2.WinForms.WebView2();
|
this.web = new Microsoft.Web.WebView2.WinForms.WebView2();
|
||||||
|
this.label1 = new System.Windows.Forms.Label();
|
||||||
((System.ComponentModel.ISupportInitialize)(this.web)).BeginInit();
|
((System.ComponentModel.ISupportInitialize)(this.web)).BeginInit();
|
||||||
this.SuspendLayout();
|
this.SuspendLayout();
|
||||||
//
|
//
|
||||||
@ -46,21 +47,34 @@
|
|||||||
this.web.TabIndex = 0;
|
this.web.TabIndex = 0;
|
||||||
this.web.ZoomFactor = 1D;
|
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
|
// ProofreadMainControl
|
||||||
//
|
//
|
||||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
|
||||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
|
this.Controls.Add(this.label1);
|
||||||
this.Controls.Add(this.web);
|
this.Controls.Add(this.web);
|
||||||
this.Name = "ProofreadMainControl";
|
this.Name = "ProofreadMainControl";
|
||||||
this.Size = new System.Drawing.Size(400, 800);
|
this.Size = new System.Drawing.Size(400, 800);
|
||||||
this.Load += new System.EventHandler(this.ProofreadMainControl_Load);
|
this.Load += new System.EventHandler(this.ProofreadMainControl_Load);
|
||||||
((System.ComponentModel.ISupportInitialize)(this.web)).EndInit();
|
((System.ComponentModel.ISupportInitialize)(this.web)).EndInit();
|
||||||
this.ResumeLayout(false);
|
this.ResumeLayout(false);
|
||||||
|
this.PerformLayout();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
public Microsoft.Web.WebView2.WinForms.WebView2 web;
|
public Microsoft.Web.WebView2.WinForms.WebView2 web;
|
||||||
|
private System.Windows.Forms.Label label1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -20,7 +20,7 @@ namespace AIProofread.Controls
|
|||||||
|
|
||||||
private void ProofreadMainControl_Load(object sender, EventArgs e)
|
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;
|
//this.SizeChanged += ProofreadMainControl_SizeChanged;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -32,5 +32,9 @@ namespace AIProofread.Controls
|
|||||||
this.Width = this.minWidth;
|
this.Width = this.minWidth;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public int LabelWidth()
|
||||||
|
{
|
||||||
|
return label1.Width;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ namespace AIProofread
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 最小宽度
|
/// 最小宽度
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private const int MinWidth = 420;
|
public static int MinWidth = 0;
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 启动路径
|
/// 启动路径
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -147,14 +147,17 @@ namespace AIProofread
|
|||||||
|
|
||||||
//proofreadPanel = new ProofreadMainControl();
|
//proofreadPanel = new ProofreadMainControl();
|
||||||
var control = new ProofreadMainControl(doc, MinWidth);
|
var control = new ProofreadMainControl(doc, MinWidth);
|
||||||
|
if (MinWidth < 10)
|
||||||
|
{
|
||||||
|
MinWidth = 420 * control.LabelWidth() / 42;
|
||||||
|
}
|
||||||
var panel = Globals.ThisAddIn.CustomTaskPanes.Add(control, AddinName);
|
var panel = Globals.ThisAddIn.CustomTaskPanes.Add(control, AddinName);
|
||||||
this.currentDocumentTaskPane = panel;
|
this.currentDocumentTaskPane = panel;
|
||||||
taskPanels.Add(doc, panel);
|
taskPanels.Add(doc, panel);
|
||||||
control.Width = MinWidth;
|
|
||||||
panel.Width = MinWidth;
|
|
||||||
panel.Visible = false;
|
panel.Visible = false;
|
||||||
panel.VisibleChanged += Panel_VisibleChanged;
|
panel.VisibleChanged += Panel_VisibleChanged;
|
||||||
|
control.Width = MinWidth;
|
||||||
|
panel.Width = MinWidth;
|
||||||
// 监听尺寸变化 防止最小尺寸小于设置值
|
// 监听尺寸变化 防止最小尺寸小于设置值
|
||||||
control.SizeChanged += Control_SizeChanged;
|
control.SizeChanged += Control_SizeChanged;
|
||||||
return panel;
|
return panel;
|
||||||
@ -185,6 +188,11 @@ namespace AIProofread
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int GetMinWidth()
|
||||||
|
{
|
||||||
|
return MinWidth;
|
||||||
|
}
|
||||||
|
|
||||||
public void Send(SendOrPostCallback d)
|
public void Send(SendOrPostCallback d)
|
||||||
{
|
{
|
||||||
FmainThreadContext.Send(d, null);
|
FmainThreadContext.Send(d, null);
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user