Merge branch 'master' of http://git.newlifex.com/NewLife/XCoder大石头 authored at 2026-07-14 08:01:57
diff --git a/XCoder/CrazyCoder.csproj b/XCoder/CrazyCoder.csproj
index 1a19e1d..99e04ee 100644
--- a/XCoder/CrazyCoder.csproj
+++ b/XCoder/CrazyCoder.csproj
@@ -70,34 +70,34 @@
<PackageReference Include="MathNet.Numerics" Version="5.0.0" />
<PackageReference Include="NAudio" Version="2.3.0" />
<PackageReference Include="NewLife.Map" Version="2.6.2026.102" />
- <PackageReference Include="NewLife.ModbusRTU" Version="2.0.2025.701" />
- <PackageReference Include="NewLife.Remoting" Version="3.7.2026.501" />
- <PackageReference Include="NewLife.Security" Version="11.15.2026.501" />
- <PackageReference Include="System.Speech" Version="10.0.7" />
+ <PackageReference Include="NewLife.ModbusRTU" Version="2.0.2026.610" />
+ <PackageReference Include="NewLife.Remoting" Version="3.8.2026.706" />
+ <PackageReference Include="NewLife.Security" Version="11.17.2026.701" />
+ <PackageReference Include="System.Speech" Version="10.0.9" />
<PackageReference Include="Microsoft.VisualBasic" Version="10.3.0" />
<PackageReference Include="NewLife.Core">
- <Version>11.15.2026.501</Version>
+ <Version>11.17.2026.701</Version>
</PackageReference>
<PackageReference Include="NewLife.MQTT">
- <Version>3.0.2026.501</Version>
+ <Version>3.1.2026.602</Version>
</PackageReference>
<PackageReference Include="NewLife.Net">
<Version>4.4.2026.206</Version>
</PackageReference>
<PackageReference Include="NewLife.Redis">
- <Version>6.5.2026.501</Version>
+ <Version>6.5.2026.701</Version>
</PackageReference>
<PackageReference Include="NewLife.Stardust">
- <Version>3.7.2026.501</Version>
+ <Version>3.9.2026.708</Version>
</PackageReference>
<PackageReference Include="NewLife.XCode">
- <Version>11.26.2026.501</Version>
+ <Version>12.0.2026.701</Version>
</PackageReference>
<PackageReference Include="SSH.NET">
<Version>2025.1.0</Version>
</PackageReference>
- <PackageReference Include="System.IO.Ports" Version="10.0.7" />
- <PackageReference Include="System.Management" Version="10.0.7" />
+ <PackageReference Include="System.IO.Ports" Version="10.0.9" />
+ <PackageReference Include="System.Management" Version="10.0.9" />
</ItemGroup>
<ItemGroup>
<Folder Include="Star\" />
diff --git a/XCoder/Data/FrmRedis.cs b/XCoder/Data/FrmRedis.cs
index f47970c..57a8a0f 100644
--- a/XCoder/Data/FrmRedis.cs
+++ b/XCoder/Data/FrmRedis.cs
@@ -17,9 +17,6 @@ public partial class FrmRedis : Form, IXForm
public FrmRedis()
{
InitializeComponent();
-
- // 动态调节宽度高度,兼容高DPI
- this.FixDpi();
}
private void FrmRedis_Load(Object sender, EventArgs e)
diff --git a/XCoder/Data/FrmRedis.Designer.cs b/XCoder/Data/FrmRedis.Designer.cs
index d9c4999..3231d90 100644
--- a/XCoder/Data/FrmRedis.Designer.cs
+++ b/XCoder/Data/FrmRedis.Designer.cs
@@ -96,8 +96,10 @@
//
// richTextBox1
//
- this.richTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ this.richTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
+ this.richTextBox1.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.richTextBox1.Location = new System.Drawing.Point(5, 23);
this.richTextBox1.Margin = new System.Windows.Forms.Padding(2, 2, 2, 2);
this.richTextBox1.Name = "richTextBox1";
@@ -107,7 +109,7 @@
//
// FrmRedis
//
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(1033, 581);
this.Controls.Add(this.gbContent);
this.Controls.Add(this.gbFunc);
diff --git a/XCoder/Data/FrmRedisConfig.Designer.cs b/XCoder/Data/FrmRedisConfig.Designer.cs
index 9380405..469d611 100644
--- a/XCoder/Data/FrmRedisConfig.Designer.cs
+++ b/XCoder/Data/FrmRedisConfig.Designer.cs
@@ -139,7 +139,7 @@ namespace XCoder.Data
//
// FrmRedisConfig
//
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(585, 263);
this.Controls.Add(this.btnOK);
this.Controls.Add(this.label5);
diff --git a/XCoder/Data/FrmSync.Designer.cs b/XCoder/Data/FrmSync.Designer.cs
index aff7398..533c704 100644
--- a/XCoder/Data/FrmSync.Designer.cs
+++ b/XCoder/Data/FrmSync.Designer.cs
@@ -133,8 +133,7 @@
//
// cbTarget
//
- this.cbTarget.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.cbTarget.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left;
this.cbTarget.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbTarget.Font = new System.Drawing.Font("Microsoft YaHei UI", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
this.cbTarget.ForeColor = System.Drawing.Color.DeepPink;
@@ -175,6 +174,7 @@
this.dataGridView1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
+ this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.DisplayedCells;
this.dataGridView1.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
this.dataGridView1.Location = new System.Drawing.Point(12, 176);
this.dataGridView1.Name = "dataGridView1";
@@ -261,7 +261,7 @@
//
// FrmSync
//
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(1104, 695);
this.Controls.Add(this.gbSetting);
this.Controls.Add(this.dataGridView1);
diff --git a/XCoder/Engine/UIConfig.cs b/XCoder/Engine/UIConfig.cs
index 7fd4c77..7ae6727 100644
--- a/XCoder/Engine/UIConfig.cs
+++ b/XCoder/Engine/UIConfig.cs
@@ -84,14 +84,12 @@ namespace XCoder
public static UIConfig Apply(TextBoxBase txt)
{
- // 加载颜色
+ // 仅加载颜色(字体由 FrmMDI 统一管理,AutoScaleMode.Dpi 自动缩放)
var ui = UIConfig.Load();
- if (ui?.Font == null) ui = null;
if (ui != null)
{
try
{
- txt.Font = ui.Font;
txt.BackColor = ui.BackColor;
txt.ForeColor = ui.ForeColor;
}
@@ -100,25 +98,20 @@ namespace XCoder
if (ui == null)
{
ui = UIConfig.Current;
- ui.Font = txt.Font;
ui.BackColor = txt.BackColor;
ui.ForeColor = txt.ForeColor;
ui.Save();
}
- // 菜单控制
+ // 菜单控制(仅保留颜色设置,字体由 FrmMDI 统一管理)
var menu = txt.ContextMenuStrip;
if (menu != null)
{
- var ti = Find(menu.Items, "字体", true);
+ var ti = Find(menu.Items, "前景色", true);
if (ti == null)
{
menu.Items.Insert(0, new ToolStripSeparator());
- ti = new ToolStripMenuItem("字体");
- menu.Items.Add(ti);
- ti.Click += mi字体_Click;
-
ti = new ToolStripMenuItem("前景色");
menu.Items.Add(ti);
ti.Click += mi前景色_Click;
@@ -157,22 +150,6 @@ namespace XCoder
return null;
}
- static void mi字体_Click(Object sender, EventArgs e)
- {
- var ti = sender as ToolStripItem;
- var txt = (ti.Owner as ContextMenuStrip).SourceControl as TextBoxBase;
-
- var fd = new FontDialog();
- fd.Font = txt.Font;
- if (fd.ShowDialog() != DialogResult.OK) return;
-
- txt.Font = fd.Font;
-
- var ui = UIConfig.Current;
- ui.Font = txt.Font;
- ui.Save();
- }
-
static void mi前景色_Click(Object sender, EventArgs e)
{
var ti = sender as ToolStripItem;
diff --git a/XCoder/FileEncoding/FrmMain.cs b/XCoder/FileEncoding/FrmMain.cs
index 333ba3b..4e7542b 100644
--- a/XCoder/FileEncoding/FrmMain.cs
+++ b/XCoder/FileEncoding/FrmMain.cs
@@ -11,9 +11,6 @@ namespace XCoder.FileEncoding
public FrmMain()
{
InitializeComponent();
-
- // 动态调节宽度高度,兼容高DPI
- this.FixDpi();
}
private void FrmEncodeReplace_Load(Object sender, EventArgs e)
diff --git a/XCoder/FileEncoding/FrmMain.Designer.cs b/XCoder/FileEncoding/FrmMain.Designer.cs
index 95f446c..21ff8cc 100644
--- a/XCoder/FileEncoding/FrmMain.Designer.cs
+++ b/XCoder/FileEncoding/FrmMain.Designer.cs
@@ -158,8 +158,7 @@
//
// FrmMain
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(789, 681);
this.Controls.Add(this.btnFind);
this.Controls.Add(this.label1);
diff --git a/XCoder/FolderInfo/FrmMain.cs b/XCoder/FolderInfo/FrmMain.cs
index 5eef2f8..b6c6d4a 100644
--- a/XCoder/FolderInfo/FrmMain.cs
+++ b/XCoder/FolderInfo/FrmMain.cs
@@ -18,9 +18,6 @@ public partial class FrmMain : Form, IXForm
{
InitializeComponent();
- // 动态调节宽度高度,兼容高DPI
- this.FixDpi();
-
//Icon = IcoHelper.GetIcon("文件");
}
diff --git a/XCoder/FolderInfo/FrmMain.Designer.cs b/XCoder/FolderInfo/FrmMain.Designer.cs
index 735af5a..5844076 100644
--- a/XCoder/FolderInfo/FrmMain.Designer.cs
+++ b/XCoder/FolderInfo/FrmMain.Designer.cs
@@ -77,6 +77,7 @@
//
this.txtLog.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
+ this.txtLog.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.txtLog.Location = new System.Drawing.Point(14, 307);
this.txtLog.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.txtLog.Name = "txtLog";
@@ -86,7 +87,7 @@
//
// FrmMain
//
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(894, 549);
this.Controls.Add(this.txtLog);
this.Controls.Add(this.treeView1);
diff --git a/XCoder/FolderInfo/FrmSplitFile.Designer.cs b/XCoder/FolderInfo/FrmSplitFile.Designer.cs
index 6e67a9e..4f6bb2c 100644
--- a/XCoder/FolderInfo/FrmSplitFile.Designer.cs
+++ b/XCoder/FolderInfo/FrmSplitFile.Designer.cs
@@ -29,7 +29,7 @@
private void InitializeComponent()
{
this.components = new System.ComponentModel.Container();
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.Text = "FrmSplitFile";
}
diff --git a/XCoder/FrmMDI.cs b/XCoder/FrmMDI.cs
index c0a5c48..58de916 100644
--- a/XCoder/FrmMDI.cs
+++ b/XCoder/FrmMDI.cs
@@ -20,10 +20,10 @@ public partial class FrmMDI : Form
InitializeComponent();
- // 动态调节宽度高度,兼容高DPI
- this.FixDpi();
-
//Icon = Source.GetIcon();
+
+ // 显式设置字体,确保 AutoScaleMode.Dpi 缩放基准正确(FixDpi 核心逻辑)
+ Font = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
}
private void FrmMDI_Shown(Object sender, EventArgs e)
@@ -136,6 +136,10 @@ public partial class FrmMDI : Form
cfg.Save();
}
+ // 设置父窗体基准字体,子控件继承后由 AutoScaleMode.Dpi 统一缩放
+ // 警告:子窗体 Designer 或运行时不得再设置显式 Font,否则会破坏 DPI 缩放链
+ frm.Font = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
+
frm.MdiParent = this;
frm.WindowState = FormWindowState.Maximized;
frm.Show();
@@ -229,4 +233,5 @@ public partial class FrmMDI : Form
}
}
#endregion
+
}
\ No newline at end of file
diff --git a/XCoder/FrmMDI.Designer.cs b/XCoder/FrmMDI.Designer.cs
index 3b07a95..45e2542 100644
--- a/XCoder/FrmMDI.Designer.cs
+++ b/XCoder/FrmMDI.Designer.cs
@@ -162,7 +162,7 @@
//
// FrmMDI
//
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(1176, 879);
this.Controls.Add(this.menuStrip);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
diff --git a/XCoder/IoT/FrmI6O6N.Designer.cs b/XCoder/IoT/FrmI6O6N.Designer.cs
index 0537a47..a694877 100644
--- a/XCoder/IoT/FrmI6O6N.Designer.cs
+++ b/XCoder/IoT/FrmI6O6N.Designer.cs
@@ -315,8 +315,7 @@
//
// FrmI6O6N
//
- AutoScaleDimensions = new SizeF(9F, 20F);
- AutoScaleMode = AutoScaleMode.Font;
+ AutoScaleMode = AutoScaleMode.Dpi;
ClientSize = new Size(921, 584);
Controls.Add(groupBox3);
Controls.Add(groupBox1);
diff --git a/XCoder/IoT/FrmModbus.Designer.cs b/XCoder/IoT/FrmModbus.Designer.cs
index 80468e9..6641479 100644
--- a/XCoder/IoT/FrmModbus.Designer.cs
+++ b/XCoder/IoT/FrmModbus.Designer.cs
@@ -222,6 +222,7 @@
// richTextBox1
//
richTextBox1.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+ richTextBox1.Font = new Font("Microsoft YaHei UI", 10.5F, FontStyle.Regular, GraphicsUnit.Point);
richTextBox1.Location = new Point(11, 227);
richTextBox1.Margin = new Padding(2);
richTextBox1.Name = "richTextBox1";
@@ -242,8 +243,7 @@
//
// FrmModbus
//
- AutoScaleDimensions = new SizeF(9F, 20F);
- AutoScaleMode = AutoScaleMode.Font;
+ AutoScaleMode = AutoScaleMode.Dpi;
ClientSize = new Size(805, 556);
Controls.Add(btnConnect2);
Controls.Add(richTextBox1);
diff --git a/XCoder/IoT/FrmSwitch.Designer.cs b/XCoder/IoT/FrmSwitch.Designer.cs
index adf9808..726d85b 100644
--- a/XCoder/IoT/FrmSwitch.Designer.cs
+++ b/XCoder/IoT/FrmSwitch.Designer.cs
@@ -265,8 +265,7 @@
//
// FrmSwitch
//
- AutoScaleDimensions = new SizeF(9F, 20F);
- AutoScaleMode = AutoScaleMode.Font;
+ AutoScaleMode = AutoScaleMode.Dpi;
ClientSize = new Size(515, 250);
Controls.Add(groupBox2);
Name = "FrmSwitch";
diff --git a/XCoder/IoT/InputPort.Designer.cs b/XCoder/IoT/InputPort.Designer.cs
index 85c4392..e848271 100644
--- a/XCoder/IoT/InputPort.Designer.cs
+++ b/XCoder/IoT/InputPort.Designer.cs
@@ -79,8 +79,7 @@
//
// Relay
//
- AutoScaleDimensions = new SizeF(9F, 20F);
- AutoScaleMode = AutoScaleMode.Font;
+ AutoScaleMode = AutoScaleMode.Dpi;
Controls.Add(label1);
Controls.Add(checkBox1);
Controls.Add(btnClose);
diff --git a/XCoder/IoT/OutputPort.Designer.cs b/XCoder/IoT/OutputPort.Designer.cs
index b3193ec..485ec41 100644
--- a/XCoder/IoT/OutputPort.Designer.cs
+++ b/XCoder/IoT/OutputPort.Designer.cs
@@ -79,8 +79,7 @@
//
// Relay
//
- AutoScaleDimensions = new SizeF(9F, 20F);
- AutoScaleMode = AutoScaleMode.Font;
+ AutoScaleMode = AutoScaleMode.Dpi;
Controls.Add(label1);
Controls.Add(checkBox1);
Controls.Add(btnClose);
diff --git a/XCoder/NewModelForm/AddField.Designer.cs b/XCoder/NewModelForm/AddField.Designer.cs
index 74d716f..d5091c7 100644
--- a/XCoder/NewModelForm/AddField.Designer.cs
+++ b/XCoder/NewModelForm/AddField.Designer.cs
@@ -223,8 +223,7 @@
//
// AddField
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.Controls.Add(this.gbInfo);
this.Name = "AddField";
this.Size = new System.Drawing.Size(468, 267);
diff --git a/XCoder/NewModelForm/AddTable.Designer.cs b/XCoder/NewModelForm/AddTable.Designer.cs
index c6ba4d8..5b36971 100644
--- a/XCoder/NewModelForm/AddTable.Designer.cs
+++ b/XCoder/NewModelForm/AddTable.Designer.cs
@@ -219,8 +219,7 @@
//
// AddTable
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.Controls.Add(this.gbTable);
this.Controls.Add(this.dgvColumns);
this.Controls.Add(this.toolStrip1);
diff --git a/XCoder/NewModelForm/BaseForm.designer.cs b/XCoder/NewModelForm/BaseForm.designer.cs
index 62ed354..abd194c 100644
--- a/XCoder/NewModelForm/BaseForm.designer.cs
+++ b/XCoder/NewModelForm/BaseForm.designer.cs
@@ -32,8 +32,7 @@
//
// FormModel
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(532, 317);
this.MaximizeBox = false;
this.MinimizeBox = false;
diff --git a/XCoder/NewModelForm/NewModel.Designer.cs b/XCoder/NewModelForm/NewModel.Designer.cs
index 8ce1a11..a6feb7c 100644
--- a/XCoder/NewModelForm/NewModel.Designer.cs
+++ b/XCoder/NewModelForm/NewModel.Designer.cs
@@ -132,8 +132,7 @@
//
// NewModel
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.Controls.Add(this.dgvTables);
this.Controls.Add(this.toolStrip1);
this.Name = "NewModel";
diff --git a/XCoder/Program.cs b/XCoder/Program.cs
index 2b6828a..4c32cbe 100644
--- a/XCoder/Program.cs
+++ b/XCoder/Program.cs
@@ -25,11 +25,9 @@ static class Program
if (set.IsNew) "学无先后达者为师,欢迎使用新生命码神工具!".SpeechTip();
+ Application.SetHighDpiMode(HighDpiMode.PerMonitorV2);
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
-#if NET5_0_OR_GREATER
- Application.SetHighDpiMode(HighDpiMode.SystemAware);
-#endif
Application.Run(new FrmMDI());
}
diff --git a/XCoder/Properties/app.manifest b/XCoder/Properties/app.manifest
index b4051b2..34e817d 100644
--- a/XCoder/Properties/app.manifest
+++ b/XCoder/Properties/app.manifest
@@ -44,15 +44,7 @@
</application>
</compatibility>
- <!-- 指示该应用程序可以感知 DPI 且 Windows 在 DPI 较高时将不会对其进行
- 自动缩放。Windows Presentation Foundation (WPF)应用程序自动感知 DPI,无需
- 选择加入。选择加入此设置的 Windows 窗体应用程序(目标设定为 .NET Framework 4.6 )还应
- 在其 app.config 中将 "EnableWindowsFormsHighDpiAutoResizing" 设置设置为 "true"。-->
- <!--<application xmlns="urn:schemas-microsoft-com:asm.v3">
- <windowsSettings>
- <dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true</dpiAware>
- </windowsSettings>
- </application>-->
+ <!-- DPI 感知由 Program.cs 中的 Application.SetHighDpiMode 配置 -->
<!-- 启用 Windows 公共控件和对话框的主题(Windows XP 和更高版本) -->
<!--
diff --git a/XCoder/Tools/FrmBackup.cs b/XCoder/Tools/FrmBackup.cs
index 0cabbbc..b73a236 100644
--- a/XCoder/Tools/FrmBackup.cs
+++ b/XCoder/Tools/FrmBackup.cs
@@ -19,9 +19,6 @@ namespace XCoder.Tools
{
InitializeComponent();
- // 动态调节宽度高度,兼容高DPI
- this.FixDpi();
-
//Font = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
//Icon = IcoHelper.GetIcon("Backup");
}
@@ -29,7 +26,6 @@ namespace XCoder.Tools
private void FrmMain_Load(Object sender, EventArgs e)
{
txtLog.UseWinFormControl();
- txtLog.SetDefaultStyle(12);
LoadConfig();
}
diff --git a/XCoder/Tools/FrmBackup.designer.cs b/XCoder/Tools/FrmBackup.designer.cs
index fddc3bf..a1b7300 100644
--- a/XCoder/Tools/FrmBackup.designer.cs
+++ b/XCoder/Tools/FrmBackup.designer.cs
@@ -73,6 +73,7 @@
// txtLog
//
this.txtLog.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.txtLog.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.txtLog.HideSelection = false;
this.txtLog.Location = new System.Drawing.Point(4, 24);
this.txtLog.Margin = new System.Windows.Forms.Padding(4);
@@ -303,7 +304,7 @@
//
// FrmBackup
//
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(1000, 631);
this.Controls.Add(this.pnlSetting);
this.Controls.Add(this.cbAllowDelete);
diff --git a/XCoder/Tools/FrmGPS.Designer.cs b/XCoder/Tools/FrmGPS.Designer.cs
index 2d37bbb..851b6e6 100644
--- a/XCoder/Tools/FrmGPS.Designer.cs
+++ b/XCoder/Tools/FrmGPS.Designer.cs
@@ -156,8 +156,7 @@
//
// FrmGPS
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(582, 172);
this.Controls.Add(this.groupBox1);
this.Name = "FrmGPS";
diff --git a/XCoder/Tools/FrmInclude.Designer.cs b/XCoder/Tools/FrmInclude.Designer.cs
index c2f88a0..b337239 100644
--- a/XCoder/Tools/FrmInclude.Designer.cs
+++ b/XCoder/Tools/FrmInclude.Designer.cs
@@ -80,6 +80,7 @@
this.rtb_msg.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
+ this.rtb_msg.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.rtb_msg.Location = new System.Drawing.Point(12, 80);
this.rtb_msg.Name = "rtb_msg";
this.rtb_msg.Size = new System.Drawing.Size(404, 167);
@@ -115,8 +116,7 @@
//
// FrmInclude
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(424, 250);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
diff --git a/XCoder/Tools/FrmMain.cs b/XCoder/Tools/FrmMain.cs
index 88b8120..b28114d 100644
--- a/XCoder/Tools/FrmMain.cs
+++ b/XCoder/Tools/FrmMain.cs
@@ -12,9 +12,6 @@ namespace XCoder.Tools
public FrmMain()
{
InitializeComponent();
-
- // 动态调节宽度高度,兼容高DPI
- this.FixDpi();
}
private void FrmMain_Load(Object sender, EventArgs e)
@@ -36,7 +33,7 @@ namespace XCoder.Tools
{
frm.TopLevel = false;
frm.Dock = DockStyle.Fill;
- frm.FormBorderStyle = FormBorderStyle.None;
+ //frm.FormBorderStyle = FormBorderStyle.None;
frm.Parent = this;
diff --git a/XCoder/Tools/FrmMain.Designer.cs b/XCoder/Tools/FrmMain.Designer.cs
index 7eaf344..d356499 100644
--- a/XCoder/Tools/FrmMain.Designer.cs
+++ b/XCoder/Tools/FrmMain.Designer.cs
@@ -75,8 +75,7 @@
//
// FrmMain
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(674, 469);
this.Controls.Add(this.panel2);
this.Controls.Add(this.panel1);
diff --git a/XCoder/Tools/FrmMD5.cs b/XCoder/Tools/FrmMD5.cs
index 1c381d0..2e432c3 100644
--- a/XCoder/Tools/FrmMD5.cs
+++ b/XCoder/Tools/FrmMD5.cs
@@ -25,9 +25,6 @@ namespace XCoder.Tools
public FrmMD5()
{
InitializeComponent();
-
- // 动态调节宽度高度,兼容高DPI
- this.FixDpi();
}
private void FrmSecurity_Load(Object sender, EventArgs e)
diff --git a/XCoder/Tools/FrmMD5.Designer.cs b/XCoder/Tools/FrmMD5.Designer.cs
index 97d509d..dbb420f 100644
--- a/XCoder/Tools/FrmMD5.Designer.cs
+++ b/XCoder/Tools/FrmMD5.Designer.cs
@@ -354,7 +354,7 @@
this.rtSource.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.rtSource.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.rtSource.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.rtSource.Location = new System.Drawing.Point(4, 72);
this.rtSource.Margin = new System.Windows.Forms.Padding(4);
this.rtSource.Name = "rtSource";
@@ -425,7 +425,7 @@
this.rtResult.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.rtResult.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.rtResult.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.rtResult.Location = new System.Drawing.Point(4, 63);
this.rtResult.Margin = new System.Windows.Forms.Padding(4);
this.rtResult.Name = "rtResult";
@@ -490,7 +490,7 @@
this.rtPass.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.rtPass.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.rtPass.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.rtPass.Location = new System.Drawing.Point(4, 71);
this.rtPass.Margin = new System.Windows.Forms.Padding(4);
this.rtPass.Name = "rtPass";
@@ -505,7 +505,7 @@
//
// FrmMD5
//
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(1304, 1049);
this.Controls.Add(this.gbPass);
this.Controls.Add(this.gbResult);
diff --git a/XCoder/Tools/FrmSecurity.cs b/XCoder/Tools/FrmSecurity.cs
index a6bdc96..78ffd4e 100644
--- a/XCoder/Tools/FrmSecurity.cs
+++ b/XCoder/Tools/FrmSecurity.cs
@@ -32,9 +32,6 @@ public partial class FrmSecurity : Form, IXForm
public FrmSecurity()
{
InitializeComponent();
-
- // 动态调节宽度高度,兼容高DPI
- this.FixDpi();
}
private void FrmSecurity_Load(Object sender, EventArgs e)
diff --git a/XCoder/Tools/FrmSecurity.Designer.cs b/XCoder/Tools/FrmSecurity.Designer.cs
index fa6cc2e..d63a217 100644
--- a/XCoder/Tools/FrmSecurity.Designer.cs
+++ b/XCoder/Tools/FrmSecurity.Designer.cs
@@ -457,7 +457,7 @@
// rtSource
//
rtSource.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
- rtSource.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point);
+ rtSource.Font = new Font("Microsoft YaHei UI", 10.5F, FontStyle.Regular, GraphicsUnit.Point);
rtSource.Location = new Point(4, 72);
rtSource.Margin = new Padding(4);
rtSource.Name = "rtSource";
@@ -524,7 +524,7 @@
// rtResult
//
rtResult.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
- rtResult.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point);
+ rtResult.Font = new Font("Microsoft YaHei UI", 10.5F, FontStyle.Regular, GraphicsUnit.Point);
rtResult.Location = new Point(4, 63);
rtResult.Margin = new Padding(4);
rtResult.Name = "rtResult";
@@ -586,7 +586,7 @@
// rtPass
//
rtPass.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
- rtPass.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point);
+ rtPass.Font = new Font("Microsoft YaHei UI", 10.5F, FontStyle.Regular, GraphicsUnit.Point);
rtPass.Location = new Point(4, 71);
rtPass.Margin = new Padding(4);
rtPass.Name = "rtPass";
@@ -607,7 +607,7 @@
//
// FrmSecurity
//
- AutoScaleMode = AutoScaleMode.None;
+ AutoScaleMode = AutoScaleMode.Dpi;
ClientSize = new Size(1304, 879);
Controls.Add(gbPass);
Controls.Add(gbResult);
diff --git a/XCoder/Tools/FrmSpeak.Designer.cs b/XCoder/Tools/FrmSpeak.Designer.cs
index 4b217f0..e463797 100644
--- a/XCoder/Tools/FrmSpeak.Designer.cs
+++ b/XCoder/Tools/FrmSpeak.Designer.cs
@@ -147,7 +147,7 @@
//
// FrmSpeak
//
- AutoScaleMode = AutoScaleMode.None;
+ AutoScaleMode = AutoScaleMode.Dpi;
ClientSize = new Size(1021, 583);
Controls.Add(btnSave);
Controls.Add(groupBox1);
diff --git a/XCoder/Tools/FrmSymmetric.cs b/XCoder/Tools/FrmSymmetric.cs
index 6cff9d2..5298ed5 100644
--- a/XCoder/Tools/FrmSymmetric.cs
+++ b/XCoder/Tools/FrmSymmetric.cs
@@ -17,9 +17,6 @@ public partial class FrmSymmetric : Form, IXForm
public FrmSymmetric()
{
InitializeComponent();
-
- // 动态调节宽度高度,兼容高DPI
- this.FixDpi();
}
private void FrmSecurity_Load(Object sender, EventArgs e)
diff --git a/XCoder/Tools/FrmSymmetric.Designer.cs b/XCoder/Tools/FrmSymmetric.Designer.cs
index 90da599..354f365 100644
--- a/XCoder/Tools/FrmSymmetric.Designer.cs
+++ b/XCoder/Tools/FrmSymmetric.Designer.cs
@@ -334,7 +334,7 @@
// rtSource
//
rtSource.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
- rtSource.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point);
+ rtSource.Font = new Font("Microsoft YaHei UI", 10.5F, FontStyle.Regular, GraphicsUnit.Point);
rtSource.Location = new Point(4, 72);
rtSource.Margin = new Padding(4);
rtSource.Name = "rtSource";
@@ -401,7 +401,7 @@
// rtResult
//
rtResult.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
- rtResult.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point);
+ rtResult.Font = new Font("Microsoft YaHei UI", 10.5F, FontStyle.Regular, GraphicsUnit.Point);
rtResult.Location = new Point(4, 63);
rtResult.Margin = new Padding(4);
rtResult.Name = "rtResult";
@@ -463,7 +463,7 @@
// rtPass
//
rtPass.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
- rtPass.Font = new Font("宋体", 12F, FontStyle.Regular, GraphicsUnit.Point);
+ rtPass.Font = new Font("Microsoft YaHei UI", 10.5F, FontStyle.Regular, GraphicsUnit.Point);
rtPass.Location = new Point(4, 71);
rtPass.Margin = new Padding(4);
rtPass.Name = "rtPass";
@@ -495,7 +495,7 @@
//
// FrmSymmetric
//
- AutoScaleMode = AutoScaleMode.None;
+ AutoScaleMode = AutoScaleMode.Dpi;
ClientSize = new Size(1304, 1049);
Controls.Add(gbPass);
Controls.Add(gbResult);
diff --git a/XCoder/Windows/AudioSelect.Designer.cs b/XCoder/Windows/AudioSelect.Designer.cs
index ed3b0b6..708b24a 100644
--- a/XCoder/Windows/AudioSelect.Designer.cs
+++ b/XCoder/Windows/AudioSelect.Designer.cs
@@ -82,6 +82,7 @@
// rtb_Info
//
rtb_Info.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
+ rtb_Info.Font = new Font("Microsoft YaHei UI", 10.5F, FontStyle.Regular, GraphicsUnit.Point);
rtb_Info.Location = new Point(57, 72);
rtb_Info.Name = "rtb_Info";
rtb_Info.ReadOnly = true;
@@ -111,8 +112,7 @@
//
// AudioSelect
//
- AutoScaleDimensions = new SizeF(7F, 17F);
- AutoScaleMode = AutoScaleMode.Font;
+ AutoScaleMode = AutoScaleMode.Dpi;
ClientSize = new Size(545, 311);
Controls.Add(lb_Volume);
Controls.Add(tb_Volume);
diff --git a/XCoder/Windows/FrmMain.cs b/XCoder/Windows/FrmMain.cs
index 6fa5b40..7473cf0 100644
--- a/XCoder/Windows/FrmMain.cs
+++ b/XCoder/Windows/FrmMain.cs
@@ -36,9 +36,6 @@ public partial class FrmMain : Form, IXForm
{
InitializeComponent();
- // 动态调节宽度高度,兼容高DPI
- this.FixDpi();
-
//Icon = IcoHelper.GetIcon("模型");
Task.Run(() => AutoLoadTables(Config.ConnName));
diff --git a/XCoder/Windows/FrmMain.designer.cs b/XCoder/Windows/FrmMain.designer.cs
index 3f4437e..7c6f041 100644
--- a/XCoder/Windows/FrmMain.designer.cs
+++ b/XCoder/Windows/FrmMain.designer.cs
@@ -142,6 +142,8 @@
this.gbTable.Controls.Add(this.btnRenderTable);
this.gbTable.Controls.Add(this.cbTableList);
this.gbTable.Controls.Add(this.label5);
+ this.gbTable.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.gbTable.Enabled = false;
this.gbTable.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
this.gbTable.ForeColor = System.Drawing.Color.ForestGreen;
@@ -204,8 +206,7 @@
//
// cbTableList
//
- this.cbTableList.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.cbTableList.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left;
this.cbTableList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbTableList.Font = new System.Drawing.Font("微软雅黑", 10F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point);
this.cbTableList.ForeColor = System.Drawing.Color.ForestGreen;
@@ -609,7 +610,7 @@
//
// FrmMain
//
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(1095, 393);
this.Controls.Add(this.label12);
this.Controls.Add(this.label11);
diff --git a/XCoder/Windows/FrmModel.Designer.cs b/XCoder/Windows/FrmModel.Designer.cs
index c11b8c3..846cd5f 100644
--- a/XCoder/Windows/FrmModel.Designer.cs
+++ b/XCoder/Windows/FrmModel.Designer.cs
@@ -238,7 +238,7 @@
//
// FrmModel
//
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(1530, 780);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.dgvIndex);
diff --git a/XCoder/Windows/FrmQuery.Designer.cs b/XCoder/Windows/FrmQuery.Designer.cs
index 7916f39..36ea272 100644
--- a/XCoder/Windows/FrmQuery.Designer.cs
+++ b/XCoder/Windows/FrmQuery.Designer.cs
@@ -118,7 +118,7 @@
//
// FrmQuery
//
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(1176, 722);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.groupBox1);
diff --git a/XCoder/Windows/FrmSchema.Designer.cs b/XCoder/Windows/FrmSchema.Designer.cs
index 913043b..04370f8 100644
--- a/XCoder/Windows/FrmSchema.Designer.cs
+++ b/XCoder/Windows/FrmSchema.Designer.cs
@@ -111,7 +111,7 @@
//
// FrmSchema
//
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(1176, 722);
this.Controls.Add(this.gv);
this.Controls.Add(this.groupBox1);
diff --git a/XCoder/Windows/FrmText.Designer.cs b/XCoder/Windows/FrmText.Designer.cs
index 8e119b3..4e88cfc 100644
--- a/XCoder/Windows/FrmText.Designer.cs
+++ b/XCoder/Windows/FrmText.Designer.cs
@@ -30,6 +30,7 @@
// richTextBox1
//
this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.richTextBox1.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.richTextBox1.Location = new System.Drawing.Point(0, 0);
this.richTextBox1.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.richTextBox1.Name = "richTextBox1";
@@ -39,7 +40,7 @@
//
// FrmText
//
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(986, 675);
this.Controls.Add(this.richTextBox1);
this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
diff --git a/XCoder/Windows/MelForm.Designer.cs b/XCoder/Windows/MelForm.Designer.cs
index 2b3b43c..6771869 100644
--- a/XCoder/Windows/MelForm.Designer.cs
+++ b/XCoder/Windows/MelForm.Designer.cs
@@ -102,8 +102,7 @@
//
// MelForm
//
- AutoScaleDimensions = new SizeF(7F, 17F);
- AutoScaleMode = AutoScaleMode.Font;
+ AutoScaleMode = AutoScaleMode.Dpi;
ClientSize = new Size(652, 404);
Controls.Add(label2);
Controls.Add(label1);
diff --git a/XCoder/Windows/UsbHelper.cs b/XCoder/Windows/UsbHelper.cs
index a98518d..bc357a4 100644
--- a/XCoder/Windows/UsbHelper.cs
+++ b/XCoder/Windows/UsbHelper.cs
@@ -13,7 +13,7 @@ namespace XCoder
/// <summary>USB复合设备</summary>
public class UsbSubDev
{
- /// <summary>MI_00, MI_01, MI_02</summary>
+ /// <summary>Microsoft Interface Number。 接口编号,复合设备特有</summary>
public int MI { get; set; }
/// <summary>名称</summary>
@@ -46,6 +46,13 @@ namespace XCoder
/// <summary>复合设备,设备名称</summary>
public List<UsbSubDev> SubDev { get; set; }
+ /// <summary>本设备是HUB时有效,无效为-1</summary>
+ public int HubId { get; set; } = -1;
+
+ /// <summary>注册表ParentIdPrefix字段</summary>
+ public String ParentIdPrefix = "";
+
+
public override string ToString()
{
var sb = new StringBuilder();
@@ -103,7 +110,6 @@ namespace XCoder
var hub = strs[1].TrimStart(hhead).ToInt();
var cid = GetContainerId(pnpId);
var (vid, pid) = GetVidPid(pnpId);
-
var dev = new UsbDevice
{
Port = port,
@@ -116,6 +122,9 @@ namespace XCoder
// ParentIdPrefix = GetParentIdPrefix(pnpId),
};
+ var pre = GetParentIdPrefix(pnpId);
+ if(!pre.IsNullOrEmpty())dev.ParentIdPrefix = pre;
+
if (roots.ContainsKey(hub)) { roots[hub].Add(dev); }
else { roots[hub] = new List<UsbDevice> { dev }; }
}
@@ -177,9 +186,59 @@ namespace XCoder
}
}
+ // UpdateHubInfo(roots);
+
return roots;
}
+ /* 方法不对,获取的id不对,屏蔽之
+ /// <summary>更新HUB之间的关系</summary>
+ /// <param name="dic"></param>
+ public static void UpdateHubInfo(Dictionary<int, List<UsbDevice>> roots)
+ {
+ foreach (var item in roots)
+ {
+ var id = item.Key;
+ var pre = GetParentIdPrefix(item.Value[0].PNPDeviceID);
+ if (pre.IsNullOrEmpty()) continue;
+
+ foreach (var item2 in roots)
+ {
+ foreach (var dev in item2.Value)
+ {
+ if (!IsHub(dev.PNPDeviceID)) continue;
+
+ if (dev.PNPDeviceID.IndexOf(pre) != -1)
+ {
+ dev.HubId = id;
+ dev.Name += $" {id}";
+
+ break;
+ }
+ }
+ }
+ }
+ }
+ */
+
+ /// <summary>获取集线集下的所有设备</summary>
+ /// <param name="hubid">集线集编号</param>
+ /// <returns></returns>
+ public static List<UsbDevice> GetHubDevs(int hubid)
+ {
+ var usbInfo = GetAllUsbInfo();
+ return usbInfo.ContainsKey(hubid) ? usbInfo[hubid] : new List<UsbDevice>();
+ }
+
+ /// <summary>获取集线集下的所有设备字典,[端口号,设备]</summary>
+ /// <param name="hubid">集线集编号</param>
+ /// <returns>[端口号,设备]</returns>
+ public static Dictionary<int, UsbDevice> GetHubDevsDic(int hubid)
+ {
+ var devs = GetHubDevs(hubid);
+ return devs.ToDictionary(d => d.Port, d => d);
+ }
+
/// <summary>打印USB设备</summary>
/// <param name="usbInfo"></param>
/// <returns></returns>
@@ -221,6 +280,39 @@ namespace XCoder
}
}
+ /// <summary>父关系前缀</summary>
+ /// <param name="devInstPath"></param>
+ /// <returns></returns>
+ public static string GetParentIdPrefix(string devInstPath)
+ {
+ if (string.IsNullOrEmpty(devInstPath)) return null;
+
+ using (var key = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Enum\" + devInstPath))
+ {
+ return key?.GetValue("ParentIdPrefix") as string;
+ }
+ }
+
+ /// <summary>判断是不是hub</summary>
+ /// <param name="devInstPath"></param>
+ /// <returns></returns>
+ public static bool IsHub(string devInstPath)
+ {
+ if (string.IsNullOrEmpty(devInstPath)) return false;
+
+ using (var key = Registry.LocalMachine.OpenSubKey(@"SYSTEM\CurrentControlSet\Enum\" + devInstPath))
+ {
+ var val = key?.GetValue("CompatibleIDs") as string[];
+ if (val == null) return false;
+ foreach (var id in val)
+ {
+ if (id.IndexOf("USB20_HUB") >= 0 || id.IndexOf("USB30_HUB") >= 0) return true;
+ }
+ }
+
+ return false;
+ }
+
/// <summary>提取VID PID</summary>
/// <param name="pnpId"></param>
/// <returns></returns>
diff --git a/XCoder/Windows/UsbHubSelect.Designer.cs b/XCoder/Windows/UsbHubSelect.Designer.cs
index d895cd9..e790750 100644
--- a/XCoder/Windows/UsbHubSelect.Designer.cs
+++ b/XCoder/Windows/UsbHubSelect.Designer.cs
@@ -48,7 +48,7 @@
// rtb_Show
//
rtb_Show.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
- rtb_Show.Font = new Font("Consolas", 9F, FontStyle.Regular, GraphicsUnit.Point, 0);
+ rtb_Show.Font = new Font("Microsoft YaHei UI", 10.5F, FontStyle.Regular, GraphicsUnit.Point);
rtb_Show.Location = new Point(12, 43);
rtb_Show.Name = "rtb_Show";
rtb_Show.Size = new Size(889, 327);
@@ -96,8 +96,7 @@
//
// UsbHubSelect
//
- AutoScaleDimensions = new SizeF(7F, 17F);
- AutoScaleMode = AutoScaleMode.Font;
+ AutoScaleMode = AutoScaleMode.Dpi;
ClientSize = new Size(913, 382);
Controls.Add(bt_flash);
Controls.Add(label1);
diff --git a/XCoder/XApi/FrmMain.cs b/XCoder/XApi/FrmMain.cs
index 0229eaf..86b24e0 100644
--- a/XCoder/XApi/FrmMain.cs
+++ b/XCoder/XApi/FrmMain.cs
@@ -28,9 +28,6 @@ public partial class FrmMain : Form, IXForm
{
InitializeComponent();
- // 动态调节宽度高度,兼容高DPI
- this.FixDpi();
-
//Font = new Font("宋体", 9F, FontStyle.Regular, GraphicsUnit.Point, 134);
//Icon = IcoHelper.GetIcon("Api");
}
@@ -41,10 +38,6 @@ public partial class FrmMain : Form, IXForm
BizLog = txtReceive.Combine(log);
txtReceive.UseWinFormControl();
- txtReceive.SetDefaultStyle(12);
- txtSend.SetDefaultStyle(12);
- numMutilSend.SetDefaultStyle(12);
-
gbReceive.Tag = gbReceive.Text;
gbSend.Tag = gbSend.Text;
diff --git a/XCoder/XApi/FrmMain.designer.cs b/XCoder/XApi/FrmMain.designer.cs
index 3d77ac9..49f0250 100644
--- a/XCoder/XApi/FrmMain.designer.cs
+++ b/XCoder/XApi/FrmMain.designer.cs
@@ -94,6 +94,7 @@
//
this.txtReceive.ContextMenuStrip = this.menuReceive;
this.txtReceive.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.txtReceive.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.txtReceive.HideSelection = false;
this.txtReceive.Location = new System.Drawing.Point(4, 24);
this.txtReceive.Margin = new System.Windows.Forms.Padding(4);
@@ -382,6 +383,7 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtSend.ContextMenuStrip = this.menuSend;
+ this.txtSend.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.txtSend.HideSelection = false;
this.txtSend.Location = new System.Drawing.Point(4, 22);
this.txtSend.Margin = new System.Windows.Forms.Padding(4);
@@ -461,7 +463,7 @@
//
// FrmMain
//
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(1000, 611);
this.Controls.Add(this.label3);
this.Controls.Add(this.cbAction);
diff --git a/XCoder/XCom/FrmMain.cs b/XCoder/XCom/FrmMain.cs
index 1cb9de9..3eadaf8 100644
--- a/XCoder/XCom/FrmMain.cs
+++ b/XCoder/XCom/FrmMain.cs
@@ -20,9 +20,6 @@ public partial class FrmMain : Form, IXForm
{
InitializeComponent();
- // 动态调节宽度高度,兼容高DPI
- this.FixDpi();
-
//Icon = IcoHelper.GetIcon("串口");
}
@@ -32,10 +29,6 @@ public partial class FrmMain : Form, IXForm
BizLog = txtReceive.Combine(log);
txtReceive.UseWinFormControl();
- txtReceive.SetDefaultStyle(12);
- txtSend.SetDefaultStyle(12);
- //numMutilSend.SetDefaultStyle(12);
-
gbReceive.Tag = gbReceive.Text;
gbSend.Tag = gbSend.Text;
diff --git a/XCoder/XCom/FrmMain.designer.cs b/XCoder/XCom/FrmMain.designer.cs
index 098c2fc..4a2fb44 100644
--- a/XCoder/XCom/FrmMain.designer.cs
+++ b/XCoder/XCom/FrmMain.designer.cs
@@ -90,6 +90,7 @@
// txtReceive
//
this.txtReceive.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.txtReceive.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.txtReceive.HideSelection = false;
this.txtReceive.Location = new System.Drawing.Point(4, 25);
this.txtReceive.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
@@ -202,6 +203,7 @@
//
// btnConnect
//
+ this.btnConnect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnConnect.Location = new System.Drawing.Point(739, 14);
this.btnConnect.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
this.btnConnect.Name = "btnConnect";
@@ -221,6 +223,7 @@
//
this.spList.BytesOfReceived = 0;
this.spList.BytesOfSent = 0;
+ this.spList.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left;
this.spList.Location = new System.Drawing.Point(18, 13);
this.spList.Margin = new System.Windows.Forms.Padding(6, 8, 6, 8);
this.spList.Name = "spList";
@@ -232,7 +235,7 @@
//
// FrmMain
//
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(848, 643);
this.Controls.Add(this.spList);
this.Controls.Add(this.gbSend);
diff --git a/XCoder/XCom/SerialPortList.designer.cs b/XCoder/XCom/SerialPortList.designer.cs
index 9edb6bb..32ac1b7 100644
--- a/XCoder/XCom/SerialPortList.designer.cs
+++ b/XCoder/XCom/SerialPortList.designer.cs
@@ -207,7 +207,7 @@
//
// SerialPortList
//
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ContextMenuStrip = this.contextMenuStrip1;
this.Controls.Add(this.cbBaudrate);
this.Controls.Add(this.label2);
diff --git a/XCoder/XICO/FrmMain.cs b/XCoder/XICO/FrmMain.cs
index 75fe621..b79ccc9 100644
--- a/XCoder/XICO/FrmMain.cs
+++ b/XCoder/XICO/FrmMain.cs
@@ -19,9 +19,6 @@ namespace XICO
{
InitializeComponent();
- // 动态调节宽度高度,兼容高DPI
- this.FixDpi();
-
//AllowDrop = true;
picSrc.AllowDrop = true;
diff --git a/XCoder/XICO/FrmMain.designer.cs b/XCoder/XICO/FrmMain.designer.cs
index a051ea5..c7ab157 100644
--- a/XCoder/XICO/FrmMain.designer.cs
+++ b/XCoder/XICO/FrmMain.designer.cs
@@ -464,7 +464,7 @@
// FrmMain
//
this.AllowDrop = true;
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(816, 690);
this.Controls.Add(this.groupBox2);
this.Controls.Add(this.groupBox1);
diff --git a/XCoder/XMessage/FrmMain.cs b/XCoder/XMessage/FrmMain.cs
index 8f16d87..79a5118 100644
--- a/XCoder/XMessage/FrmMain.cs
+++ b/XCoder/XMessage/FrmMain.cs
@@ -50,10 +50,6 @@ namespace XMessage
BizLog = txtReceive.Combine(log);
txtReceive.UseWinFormControl();
- txtReceive.SetDefaultStyle(12);
- txtSend.SetDefaultStyle(12);
- numMutilSend.SetDefaultStyle(12);
-
gbReceive.Tag = gbReceive.Text;
gbSend.Tag = gbSend.Text;
diff --git a/XCoder/XMessage/FrmMain.designer.cs b/XCoder/XMessage/FrmMain.designer.cs
index 06b2daa..591e30d 100644
--- a/XCoder/XMessage/FrmMain.designer.cs
+++ b/XCoder/XMessage/FrmMain.designer.cs
@@ -91,6 +91,7 @@
//
this.txtReceive.ContextMenuStrip = this.menuReceive;
this.txtReceive.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.txtReceive.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.txtReceive.HideSelection = false;
this.txtReceive.Location = new System.Drawing.Point(3, 17);
this.txtReceive.Name = "txtReceive";
@@ -342,6 +343,7 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtSend.ContextMenuStrip = this.menuSend;
+ this.txtSend.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.txtSend.HideSelection = false;
this.txtSend.Location = new System.Drawing.Point(0, 19);
this.txtSend.Name = "txtSend";
@@ -413,8 +415,7 @@
//
// FrmMain
//
- this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(667, 379);
this.Controls.Add(this.gbSend);
this.Controls.Add(this.pnlSetting);
diff --git a/XCoder/XNet/FrmApiDiscover.cs b/XCoder/XNet/FrmApiDiscover.cs
index f6a640b..07b27d2 100644
--- a/XCoder/XNet/FrmApiDiscover.cs
+++ b/XCoder/XNet/FrmApiDiscover.cs
@@ -23,9 +23,6 @@ public partial class FrmApiDiscover : Form, IXForm
public FrmApiDiscover()
{
InitializeComponent();
-
- // 动态调节宽度高度,兼容高DPI
- this.FixDpi();
}
private void FrmMain_Load(Object sender, EventArgs e)
diff --git a/XCoder/XNet/FrmApiDiscover.designer.cs b/XCoder/XNet/FrmApiDiscover.designer.cs
index 5f7e383..3988f95 100644
--- a/XCoder/XNet/FrmApiDiscover.designer.cs
+++ b/XCoder/XNet/FrmApiDiscover.designer.cs
@@ -156,7 +156,7 @@
//
// FrmApiDiscover
//
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(1000, 632);
this.Controls.Add(this.pnlSetting);
this.Controls.Add(this.btnDiscover);
diff --git a/XCoder/XNet/FrmIp.cs b/XCoder/XNet/FrmIp.cs
index f74d650..1eb2910 100644
--- a/XCoder/XNet/FrmIp.cs
+++ b/XCoder/XNet/FrmIp.cs
@@ -16,9 +16,6 @@ public partial class FrmIp : Form, IXForm
{
InitializeComponent();
- // 动态调节宽度高度,兼容高DPI
- this.FixDpi();
-
//Icon = IcoHelper.GetIcon("IP");
}
diff --git a/XCoder/XNet/FrmIp.designer.cs b/XCoder/XNet/FrmIp.designer.cs
index b59778a..3959dd7 100644
--- a/XCoder/XNet/FrmIp.designer.cs
+++ b/XCoder/XNet/FrmIp.designer.cs
@@ -232,7 +232,7 @@
//
// FrmIp
//
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(880, 631);
this.Controls.Add(this.pnlSetting);
this.Controls.Add(this.gbInfo);
diff --git a/XCoder/XNet/FrmMain.cs b/XCoder/XNet/FrmMain.cs
index c05dbeb..9bd8608 100644
--- a/XCoder/XNet/FrmMain.cs
+++ b/XCoder/XNet/FrmMain.cs
@@ -35,9 +35,6 @@ public partial class FrmMain : Form, IXForm
{
InitializeComponent();
- // 动态调节宽度高度,兼容高DPI
- this.FixDpi();
-
//Icon = IcoHelper.GetIcon("网络");
}
@@ -47,10 +44,6 @@ public partial class FrmMain : Form, IXForm
BizLog = txtReceive.Combine(log);
txtReceive.UseWinFormControl();
- txtReceive.SetDefaultStyle(12);
- txtSend.SetDefaultStyle(12);
- //numMutilSend.SetDefaultStyle(12);
-
gbReceive.Tag = gbReceive.Text;
gbSend.Tag = gbSend.Text;
diff --git a/XCoder/XNet/FrmMain.designer.cs b/XCoder/XNet/FrmMain.designer.cs
index bf07131..6195591 100644
--- a/XCoder/XNet/FrmMain.designer.cs
+++ b/XCoder/XNet/FrmMain.designer.cs
@@ -97,6 +97,7 @@
//
txtReceive.ContextMenuStrip = menuReceive;
txtReceive.Dock = DockStyle.Fill;
+ txtReceive.Font = new Font("Microsoft YaHei UI", 10.5F, FontStyle.Regular, GraphicsUnit.Point);
txtReceive.HideSelection = false;
txtReceive.Location = new Point(4, 21);
txtReceive.Margin = new Padding(4, 5, 4, 5);
@@ -215,6 +216,7 @@
//
// btnConnect
//
+ btnConnect.Anchor = AnchorStyles.Top | AnchorStyles.Right;
btnConnect.Location = new Point(880, 13);
btnConnect.Margin = new Padding(4, 5, 4, 5);
btnConnect.Name = "btnConnect";
@@ -293,6 +295,7 @@
pnlSetting.Controls.Add(label1);
pnlSetting.Controls.Add(lbLocal);
pnlSetting.Controls.Add(cbMode);
+ pnlSetting.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right;
pnlSetting.Location = new Point(13, 11);
pnlSetting.Margin = new Padding(4, 5, 4, 5);
pnlSetting.Name = "pnlSetting";
@@ -367,6 +370,7 @@
//
txtSend.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right;
txtSend.ContextMenuStrip = menuSend;
+ txtSend.Font = new Font("Microsoft YaHei UI", 10.5F, FontStyle.Regular, GraphicsUnit.Point);
txtSend.HideSelection = false;
txtSend.Location = new Point(4, 24);
txtSend.Margin = new Padding(4, 5, 4, 5);
@@ -431,7 +435,7 @@
//
// FrmMain
//
- AutoScaleMode = AutoScaleMode.None;
+ AutoScaleMode = AutoScaleMode.Dpi;
ClientSize = new Size(1000, 632);
Controls.Add(gbSend);
Controls.Add(pnlSetting);
diff --git a/XCoder/XNet/FrmModbusMaster.cs b/XCoder/XNet/FrmModbusMaster.cs
index 017f8a8..d69cbe2 100644
--- a/XCoder/XNet/FrmModbusMaster.cs
+++ b/XCoder/XNet/FrmModbusMaster.cs
@@ -23,17 +23,12 @@ namespace XNet
public FrmModbusMaster()
{
InitializeComponent();
-
- // 动态调节宽度高度,兼容高DPI
- this.FixDpi();
}
private void FrmMain_Load(Object sender, EventArgs e)
{
_log = new TextControlLog { Control = txtReceive };
- txtReceive.SetDefaultStyle(12);
-
var dic = EnumHelper.GetDescriptions(typeof(FunctionCodes));
cbFunctionCode.ValueMember = "key";
cbFunctionCode.DisplayMember = "value";
diff --git a/XCoder/XNet/FrmModbusMaster.designer.cs b/XCoder/XNet/FrmModbusMaster.designer.cs
index 1bc0f5d..de850a3 100644
--- a/XCoder/XNet/FrmModbusMaster.designer.cs
+++ b/XCoder/XNet/FrmModbusMaster.designer.cs
@@ -278,6 +278,7 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtReceive.ContextMenuStrip = this.menuReceive;
+ this.txtReceive.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.txtReceive.HideSelection = false;
this.txtReceive.Location = new System.Drawing.Point(401, 76);
this.txtReceive.Margin = new System.Windows.Forms.Padding(5);
@@ -384,7 +385,7 @@
//
// FrmModbusMaster
//
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(1000, 632);
this.Controls.Add(this.btnAdd);
this.Controls.Add(this.dgv);
diff --git a/XCoder/XNet/FrmModbusSlave.cs b/XCoder/XNet/FrmModbusSlave.cs
index c3e7da1..9528c96 100644
--- a/XCoder/XNet/FrmModbusSlave.cs
+++ b/XCoder/XNet/FrmModbusSlave.cs
@@ -30,9 +30,6 @@ namespace XNet
public FrmModbusSlave()
{
InitializeComponent();
-
- // 动态调节宽度高度,兼容高DPI
- this.FixDpi();
}
private void FrmMain_Load(Object sender, EventArgs e)
@@ -41,8 +38,6 @@ namespace XNet
if (cbMode.SelectedIndex < 0) cbMode.SelectedIndex = 0;
- txtReceive.SetDefaultStyle(12);
-
// 加载保存的颜色
UIConfig.Apply(txtReceive);
diff --git a/XCoder/XNet/FrmModbusSlave.designer.cs b/XCoder/XNet/FrmModbusSlave.designer.cs
index 5e3f72d..b5140b6 100644
--- a/XCoder/XNet/FrmModbusSlave.designer.cs
+++ b/XCoder/XNet/FrmModbusSlave.designer.cs
@@ -71,6 +71,7 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtReceive.ContextMenuStrip = this.menuReceive;
+ this.txtReceive.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.txtReceive.HideSelection = false;
this.txtReceive.Location = new System.Drawing.Point(401, 73);
this.txtReceive.Margin = new System.Windows.Forms.Padding(4, 6, 4, 6);
@@ -394,7 +395,7 @@
//
// FrmModbusSlave
//
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(1107, 632);
this.Controls.Add(this.btnAdd);
this.Controls.Add(this.txtReceive);
diff --git a/XCoder/XNet/FrmMqtt.cs b/XCoder/XNet/FrmMqtt.cs
index d79100f..f397fda 100644
--- a/XCoder/XNet/FrmMqtt.cs
+++ b/XCoder/XNet/FrmMqtt.cs
@@ -26,9 +26,6 @@ namespace XNet
{
InitializeComponent();
- // 动态调节宽度高度,兼容高DPI
- this.FixDpi();
-
//Icon = IcoHelper.GetIcon("SSH");
}
@@ -46,8 +43,6 @@ namespace XNet
//txtReceive.UseWinFormControl();
txtReceive.Clear();
- txtReceive.SetDefaultStyle(12);
- txtSend.SetDefaultStyle(12);
}
#endregion
diff --git a/XCoder/XNet/FrmMqtt.designer.cs b/XCoder/XNet/FrmMqtt.designer.cs
index 853000f..023850a 100644
--- a/XCoder/XNet/FrmMqtt.designer.cs
+++ b/XCoder/XNet/FrmMqtt.designer.cs
@@ -96,6 +96,7 @@
//
this.txtReceive.ContextMenuStrip = this.menuReceive;
this.txtReceive.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.txtReceive.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.txtReceive.HideSelection = false;
this.txtReceive.Location = new System.Drawing.Point(4, 23);
this.txtReceive.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
@@ -150,6 +151,7 @@
//
// btnConnect
//
+ this.btnConnect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
this.btnConnect.Font = new System.Drawing.Font("微软雅黑", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.btnConnect.Location = new System.Drawing.Point(978, 47);
this.btnConnect.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
@@ -298,6 +300,7 @@
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtSend.ContextMenuStrip = this.menuSend;
+ this.txtSend.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.txtSend.HideSelection = false;
this.txtSend.Location = new System.Drawing.Point(4, 73);
this.txtSend.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
@@ -397,6 +400,8 @@
this.gbSubscribe.Controls.Add(this.cbTopic);
this.gbSubscribe.Controls.Add(this.label12);
this.gbSubscribe.Enabled = false;
+ this.gbSubscribe.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.gbSubscribe.Location = new System.Drawing.Point(16, 136);
this.gbSubscribe.Name = "gbSubscribe";
this.gbSubscribe.Size = new System.Drawing.Size(924, 87);
@@ -473,6 +478,8 @@
this.gbSetting.Controls.Add(this.txtPath);
this.gbSetting.Controls.Add(this.label3);
this.gbSetting.Controls.Add(this.label2);
+ this.gbSetting.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
this.gbSetting.Location = new System.Drawing.Point(14, 10);
this.gbSetting.Name = "gbSetting";
this.gbSetting.Size = new System.Drawing.Size(923, 117);
@@ -482,14 +489,14 @@
//
// FrmMqtt
//
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(1111, 864);
this.Controls.Add(this.gbSubscribe);
this.Controls.Add(this.gbSetting);
this.Controls.Add(this.gbSend);
this.Controls.Add(this.btnConnect);
this.Controls.Add(this.gbReceive);
- this.Font = new System.Drawing.Font("宋体", 10F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
+ this.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
this.Name = "FrmMqtt";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
diff --git a/XCoder/XNet/FrmSsh.cs b/XCoder/XNet/FrmSsh.cs
index 81fca82..5a811dc 100644
--- a/XCoder/XNet/FrmSsh.cs
+++ b/XCoder/XNet/FrmSsh.cs
@@ -23,9 +23,6 @@ namespace XNet
{
InitializeComponent();
- // 动态调节宽度高度,兼容高DPI
- this.FixDpi();
-
//Icon = IcoHelper.GetIcon("SSH");
}
@@ -38,9 +35,6 @@ namespace XNet
//txtReceive.UseWinFormControl();
txtReceive.Clear();
- txtReceive.SetDefaultStyle(12);
- txtSend.SetDefaultStyle(12);
-
gbReceive.Tag = gbReceive.Text;
gbSend.Tag = gbSend.Text;
}
diff --git a/XCoder/XNet/FrmSsh.designer.cs b/XCoder/XNet/FrmSsh.designer.cs
index a6b1f97..dfe6bf0 100644
--- a/XCoder/XNet/FrmSsh.designer.cs
+++ b/XCoder/XNet/FrmSsh.designer.cs
@@ -76,6 +76,7 @@
//
this.txtReceive.ContextMenuStrip = this.menuReceive;
this.txtReceive.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.txtReceive.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.txtReceive.HideSelection = false;
this.txtReceive.Location = new System.Drawing.Point(4, 24);
this.txtReceive.Margin = new System.Windows.Forms.Padding(4);
@@ -233,8 +234,7 @@
this.txtSend.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
- this.txtSend.ContextMenuStrip = this.menuSend;
- this.txtSend.HideSelection = false;
+ this.txtSend.ContextMenuStrip = this.menuSend; this.txtSend.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.txtSend.HideSelection = false;
this.txtSend.Location = new System.Drawing.Point(0, 31);
this.txtSend.Margin = new System.Windows.Forms.Padding(4);
this.txtSend.Name = "txtSend";
@@ -256,7 +256,7 @@
//
// FrmSsh
//
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(1000, 631);
this.Controls.Add(this.gbSend);
this.Controls.Add(this.pnlSetting);
diff --git a/XCoder/XRegex/FrmMain.cs b/XCoder/XRegex/FrmMain.cs
index e7985c0..431d079 100644
--- a/XCoder/XRegex/FrmMain.cs
+++ b/XCoder/XRegex/FrmMain.cs
@@ -20,9 +20,6 @@ namespace NewLife.XRegex
{
InitializeComponent();
- // 动态调节宽度高度,兼容高DPI
- this.FixDpi();
-
//Icon = IcoHelper.GetIcon("正则");
FileResource.CheckTemplate();
diff --git a/XCoder/XRegex/FrmMain.designer.cs b/XCoder/XRegex/FrmMain.designer.cs
index c785fed..cd52ac2 100644
--- a/XCoder/XRegex/FrmMain.designer.cs
+++ b/XCoder/XRegex/FrmMain.designer.cs
@@ -581,7 +581,7 @@
//
// FrmMain
//
- AutoScaleMode = AutoScaleMode.None;
+ AutoScaleMode = AutoScaleMode.Dpi;
ClientSize = new Size(1176, 936);
Controls.Add(splitContainer1);
Controls.Add(statusStrip1);
diff --git a/XCoder/Yun/FrmMap.cs b/XCoder/Yun/FrmMap.cs
index e2c93e0..55d0526 100644
--- a/XCoder/Yun/FrmMap.cs
+++ b/XCoder/Yun/FrmMap.cs
@@ -23,9 +23,6 @@ public partial class FrmMap : Form, IXForm
{
InitializeComponent();
- // 动态调节宽度高度,兼容高DPI
- this.FixDpi();
-
//Icon = IcoHelper.GetIcon("地图");
}
@@ -35,8 +32,6 @@ public partial class FrmMap : Form, IXForm
BizLog = txtReceive.Combine(XTrace.Log);
txtReceive.UseWinFormControl();
- txtReceive.SetDefaultStyle(12);
-
// 加载保存的颜色
UIConfig.Apply(txtReceive);
diff --git a/XCoder/Yun/FrmMap.Designer.cs b/XCoder/Yun/FrmMap.Designer.cs
index 2613230..102f8cc 100644
--- a/XCoder/Yun/FrmMap.Designer.cs
+++ b/XCoder/Yun/FrmMap.Designer.cs
@@ -168,14 +168,11 @@
//
// pgResult
//
- this.pgResult.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Right)));
+ this.pgResult.Dock = System.Windows.Forms.DockStyle.Fill;
this.pgResult.LineColor = System.Drawing.SystemColors.ControlDark;
- this.pgResult.Location = new System.Drawing.Point(579, 180);
this.pgResult.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.pgResult.Name = "pgResult";
this.pgResult.PropertySort = System.Windows.Forms.PropertySort.NoSort;
- this.pgResult.Size = new System.Drawing.Size(421, 625);
this.pgResult.TabIndex = 25;
//
// btnInvoke
@@ -192,6 +189,7 @@
// txtReceive
//
this.txtReceive.Dock = System.Windows.Forms.DockStyle.Fill;
+ this.txtReceive.Font = new System.Drawing.Font("Microsoft YaHei UI", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point);
this.txtReceive.HideSelection = false;
this.txtReceive.Location = new System.Drawing.Point(5, 25);
this.txtReceive.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
@@ -211,15 +209,11 @@
//
// gbReceive
//
- this.gbReceive.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
- | System.Windows.Forms.AnchorStyles.Left)
- | System.Windows.Forms.AnchorStyles.Right)));
this.gbReceive.Controls.Add(this.txtReceive);
- this.gbReceive.Location = new System.Drawing.Point(3, 180);
+ this.gbReceive.Dock = System.Windows.Forms.DockStyle.Fill;
this.gbReceive.Margin = new System.Windows.Forms.Padding(5, 5, 5, 5);
this.gbReceive.Name = "gbReceive";
this.gbReceive.Padding = new System.Windows.Forms.Padding(5, 5, 5, 5);
- this.gbReceive.Size = new System.Drawing.Size(571, 630);
this.gbReceive.TabIndex = 24;
this.gbReceive.TabStop = false;
//
@@ -266,9 +260,29 @@
this.txtLocation2.Size = new System.Drawing.Size(315, 27);
this.txtLocation2.TabIndex = 40;
//
+ // tableLayoutPanel1
+ //
+ this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
+ this.tableLayoutPanel1.SuspendLayout();
+ this.tableLayoutPanel1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+ | System.Windows.Forms.AnchorStyles.Left)
+ | System.Windows.Forms.AnchorStyles.Right)));
+ this.tableLayoutPanel1.ColumnCount = 2;
+ this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 180);
+ this.tableLayoutPanel1.Name = "tableLayoutPanel1";
+ this.tableLayoutPanel1.RowCount = 1;
+ this.tableLayoutPanel1.Size = new System.Drawing.Size(997, 630);
+ this.tableLayoutPanel1.TabIndex = 41;
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
+ this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 421F));
+ this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
+ this.tableLayoutPanel1.Controls.Add(this.gbReceive, 0, 0);
+ this.tableLayoutPanel1.Controls.Add(this.pgResult, 1, 0);
+ //
// FrmMap
//
- this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
+ this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
+ this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi;
this.ClientSize = new System.Drawing.Size(1005, 813);
this.Controls.Add(this.label7);
this.Controls.Add(this.txtLocation2);
@@ -282,9 +296,8 @@
this.Controls.Add(this.txtCity);
this.Controls.Add(this.txtAddress);
this.Controls.Add(this.cbMap);
- this.Controls.Add(this.pgResult);
this.Controls.Add(this.btnInvoke);
- this.Controls.Add(this.gbReceive);
+ this.Controls.Add(this.tableLayoutPanel1);
this.Controls.Add(this.label3);
this.Controls.Add(this.txtLocation);
this.Controls.Add(this.chkFormatAddress);
@@ -294,6 +307,7 @@
this.Text = "地图接口";
this.Load += new System.EventHandler(this.FrmMain_Load);
this.gbReceive.ResumeLayout(false);
+ this.tableLayoutPanel1.ResumeLayout(false);
this.ResumeLayout(false);
this.PerformLayout();
@@ -324,5 +338,6 @@
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.TextBox txtLocation2;
+ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
}
}
\ No newline at end of file