From 3d4efebdb53ceefa84c83c7bd2ad24aec242a758 Mon Sep 17 00:00:00 2001 From: tian <11429339@qq.com> Date: Wed, 30 Jul 2025 13:58:21 +0800 Subject: [PATCH] =?UTF-8?q?=E7=95=8C=E9=9D=A2=E5=BE=AE=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .kiro/specs/ui-scaling-enhancement/design.md | 221 ++++++++++++++++++ .../ui-scaling-enhancement/requirements.md | 67 ++++++ .vscode/settings.json | 3 +- src/MainPlugin.cs | 200 ++++++++-------- src/ModelSplitterDialog.cs | 10 +- 5 files changed, 387 insertions(+), 114 deletions(-) create mode 100644 .kiro/specs/ui-scaling-enhancement/design.md create mode 100644 .kiro/specs/ui-scaling-enhancement/requirements.md diff --git a/.kiro/specs/ui-scaling-enhancement/design.md b/.kiro/specs/ui-scaling-enhancement/design.md new file mode 100644 index 0000000..477a877 --- /dev/null +++ b/.kiro/specs/ui-scaling-enhancement/design.md @@ -0,0 +1,221 @@ +# 设计文档:UI缩放增强 + +## 概述 + +本设计文档描述了如何改善Navisworks插件在4K高分辨率显示器上的用户界面显示效果。根据用户反馈,插件在2K显示器上显示正常,但在4K显示器上(使用150%缩放,实际显示为2560*1440)显示过小,导致按钮中的文字显示不全、组件高度不足等问题。模型分层拆分工具的弹出对话框在4K显示器上已经能够正常显示,因此本设计将参考该实现来调整MainPlugin中的按钮尺寸、分组区域高度和主窗口大小。 + +## 设计方案 + +本设计采用最简单直接的方案,只调整MainPlugin中的按钮尺寸、分组区域高度和主窗口大小,不修改其他任何代码。主要调整内容包括: + +1. **增加主窗口尺寸**:参考ModelSplitterDialog的尺寸,适当增加MainPlugin主窗口的宽度和高度。 +2. **调整按钮尺寸**:参考ModelSplitterDialog中的按钮尺寸,增加MainPlugin中所有按钮的宽度和高度。 +3. **调整分组区域高度**:增加GroupBox的高度,确保能容纳调整后的按钮并有合理间距。 +4. **增加路径列表和表格高度**:特别增加路径编辑标签页中的路径列表和当前路径编辑表格的高度,使其能容纳的行数从3行增加到4行。 + +### 参考ModelSplitterDialog的实现 + +通过分析ModelSplitterDialog.cs,我们发现以下关键设置: + +```csharp +// 窗口大小设置 +this.Size = new Size(800, 720); + +// 按钮大小设置 +Size = new Size(100, 30) // 主要按钮 +Size = new Size(80, 30) // 次要按钮 + +// GroupBox高度设置 +Size = new Size(350, 160) // 较大的分组区域 +Size = new Size(350, 80) // 较小的分组区域 +``` + +## 具体实现方案 + +### 1. 主窗口尺寸调整 + +将MainPlugin中的主窗口从当前尺寸调整为更大的尺寸: + +```csharp +// 原始尺寸 +_controlPanelForm = new Form +{ + Text = "物流路径规划控制面板", + Size = new Size(420, 700), + // 其他属性... +}; + +// 调整后的尺寸 +_controlPanelForm = new Form +{ + Text = "物流路径规划控制面板", + Size = new Size(500, 820), // 增加宽度和高度,以容纳更大的路径列表和表格 + // 其他属性... +}; +``` + +### 2. 按钮尺寸调整 + +增加MainPlugin中所有按钮的宽度和高度,参考ModelSplitterDialog中的按钮尺寸: + +```csharp +// 原始按钮尺寸 +Button button = new Button +{ + Text = "按钮文本", + Size = new Size(60, 25), + // 其他属性... +}; + +// 调整后的按钮尺寸 - 主要按钮 +Button mainButton = new Button +{ + Text = "主要按钮", + Size = new Size(100, 30), // 参考ModelSplitterDialog的主要按钮尺寸 + // 其他属性... +}; + +// 调整后的按钮尺寸 - 次要按钮 +Button secondaryButton = new Button +{ + Text = "次要按钮", + Size = new Size(80, 30), // 参考ModelSplitterDialog的次要按钮尺寸 + // 其他属性... +}; +``` + +### 3. 分组区域高度调整 + +增加GroupBox的高度,确保能容纳调整后的按钮并有合理间距: + +```csharp +// 原始GroupBox尺寸 +GroupBox groupBox = new GroupBox +{ + Text = "分组标题", + Size = new Size(350, 70), // 或其他高度 + // 其他属性... +}; + +// 调整后的GroupBox尺寸 +GroupBox groupBox = new GroupBox +{ + Text = "分组标题", + Size = new Size(350, 90), // 增加高度,确保有足够空间容纳更大的按钮 + // 其他属性... +}; +``` + +### 4. 路径列表和表格高度调整 + +特别增加路径编辑标签页中的路径列表和当前路径编辑表格的高度: + +```csharp +// 原始路径列表尺寸 +_pathListView = new ListView +{ + // 其他属性... + Size = new Size(350, 100), // 假设原始高度为100 +}; + +// 调整后的路径列表尺寸 +_pathListView = new ListView +{ + // 其他属性... + Size = new Size(350, 140), // 增加高度,使其能容纳4行 +}; + +// 原始路径点列表尺寸 +_currentPathPointsListView = new ListView +{ + // 其他属性... + Size = new Size(350, 100), // 假设原始高度为100 +}; + +// 调整后的路径点列表尺寸 +_currentPathPointsListView = new ListView +{ + // 其他属性... + Size = new Size(350, 140), // 增加高度,使其能容纳4行 +}; +``` + +## 需要修改的位置 + +### 1. MainPlugin.cs中的ShowCategorySelectionDialog方法 + +修改主窗口尺寸: + +```csharp +_controlPanelForm = new Form +{ + Text = "物流路径规划控制面板", + Size = new Size(500, 820), // 从(420, 700)调整为(500, 820) + // 其他属性保持不变... +}; +``` + +### 2. 各个标签页中的分组区域和按钮 + +在以下方法中找到所有GroupBox和Button的Size属性,并进行调整: + +- CreateModelSettingsTab +- CreatePathEditingTab +- CreateAnimationControlTab +- CreateSystemManagementTab + +例如: + +```csharp +// 原始代码 +GroupBox groupBox = new GroupBox +{ + Text = "分组标题", + Size = new Size(350, 70), + // 其他属性... +}; + +Button button = new Button +{ + Text = "按钮文本", + Size = new Size(60, 25), + // 其他属性... +}; + +// 修改为 +GroupBox groupBox = new GroupBox +{ + Text = "分组标题", + Size = new Size(350, 90), // 增加高度 + // 其他属性保持不变... +}; + +Button button = new Button +{ + Text = "按钮文本", + Size = new Size(100, 30), // 或 Size = new Size(80, 30),根据按钮重要性 + // 其他属性保持不变... +}; +``` + +### 3. 路径编辑标签页中的列表 + +特别关注CreatePathEditingTab方法中的路径列表和当前路径编辑表格: + +```csharp +// 找到路径列表和当前路径编辑表格的定义 +_pathListView.Size = new Size(350, 140); // 增加高度 +_currentPathPointsListView.Size = new Size(350, 140); // 增加高度 + +// 同时调整包含这些列表的GroupBox高度 +pathListGroupBox.Size = new Size(350, 200); // 从160增加到200 +currentPathGroupBox.Size = new Size(350, 290); // 从250增加到290 +``` + +## 实现注意事项 + +1. **只修改尺寸数据**:只调整窗口、分组区域、列表和按钮的Size属性,不修改其他任何代码。 +2. **保持一致性**:确保所有按钮的调整保持一致,主要按钮使用(100, 30),次要按钮使用(80, 30)。 +3. **合理间距**:确保增加GroupBox高度后,内部控件有足够的间距,不会显得拥挤。 +4. **路径列表特别关注**:确保路径列表和当前路径编辑表格能容纳4行数据,提高用户体验。 +5. **最小化修改**:只针对MainPlugin.cs文件进行修改,不涉及其他文件。 diff --git a/.kiro/specs/ui-scaling-enhancement/requirements.md b/.kiro/specs/ui-scaling-enhancement/requirements.md new file mode 100644 index 0000000..96c71ab --- /dev/null +++ b/.kiro/specs/ui-scaling-enhancement/requirements.md @@ -0,0 +1,67 @@ +# 需求文档 + +## 简介 + +UI缩放增强功能旨在改善插件在高分辨率(4K)显示器上的用户界面显示效果。目前,插件的UI元素(按钮、文本、间距)在2K显示器上显示正常,但在4K显示器上显示过小,导致按钮中的文字显示不全、组件高度不足等问题。模型分层拆分工具的弹出对话框在4K显示器上已经能够正常显示,因此本功能将参考该实现来调整插件主窗口及其标签页。 + +## 需求 + +### 需求1:插件主窗口的UI缩放 + +**用户故事:** 作为使用4K显示器的插件用户,我希望插件主窗口能够适当缩放,以便我能清晰地看到所有UI元素,而不会出现文字被截断的情况。 + +#### 验收标准1 + +1. 当插件在4K显示器上启动时,插件主窗口应自动调整其大小以保持可读性。 +2. 当插件在4K显示器上显示时,按钮和标签中的所有文本应完全可见,不会被截断。 +3. 当插件在4K显示器上显示时,UI元素之间的间距应按比例调整,以保持视觉层次结构。 +4. 当插件在2K显示器上显示时,UI应保持其当前的适当大小。 +5. 当插件窗口大小改变时,所有UI元素应保持其相对比例和可读性。 + +### 需求2:标签页控件的UI缩放 + +**用户故事:** 作为使用4K显示器的插件用户,我希望所有标签页及其控件能够适当缩放,以便我能有效地与它们交互。 + +#### 验收标准2 + +1. 当任何标签页在4K显示器上显示时,标签页内的所有控件应具有适当的大小和间距。 +2. 当"类别设置"标签页在4K显示器上显示时,所有列表视图、组合框和按钮应具有适当的大小。 +3. 当"路径编辑"标签页在4K显示器上显示时,所有路径编辑控件应具有适当的大小并完全可用。 +4. 当"检测动画"标签页在4K显示器上显示时,所有动画控件应具有适当的大小并完全可用。 +5. 当"系统管理"标签页在4K显示器上显示时,所有系统管理控件应具有适当的大小并完全可用。 + +### 需求3:字体缩放 + +**用户故事:** 作为使用4K显示器的插件用户,我希望插件中的所有文本都能适当调整大小,以便我能够轻松阅读。 + +#### 验收标准3 + +1. 当插件在4K显示器上显示时,所有字体应按比例缩放以保持可读性。 +2. 当按钮在4K显示器上显示文本时,字体大小应按比例增加,以确保文本完全可见。 +3. 当标签在4K显示器上显示文本时,字体大小应按比例增加,以确保可读性。 +4. 当列表视图在4K显示器上显示文本时,字体大小应按比例增加,以确保可读性。 +5. 当插件在2K显示器上显示时,字体大小应保持其当前的适当大小。 + +### 需求4:DPI感知实现 + +**用户故事:** 作为插件开发人员,我希望在插件中实现适当的DPI感知功能,以便它能够自动适应不同的显示分辨率。 + +#### 验收标准4 + +1. 当插件启动时,它应检测当前显示器的DPI设置。 +2. 当插件检测到高DPI设置时,它应自动调整UI缩放因子。 +3. 当插件在具有不同DPI设置的显示器之间移动时,它应相应地调整其缩放。 +4. 当系统DPI设置更改时,插件应在下次启动时适当响应。 +5. 如果插件无法确定DPI设置,则应默认为标准缩放,不会出现错误。 + +### 需求5:一致的UI元素比例 + +**用户故事:** 作为插件用户,我希望UI元素在不同显示分辨率下保持一致的比例,以便界面保持熟悉和可用。 + +#### 验收标准5 + +1. 当插件针对不同分辨率进行缩放时,UI元素的相对大小应保持一致。 +2. 当插件针对不同分辨率进行缩放时,UI元素的布局和定位应保持一致。 +3. 当列表视图在不同分辨率上显示时,列宽应按比例缩放。 +4. 当分组框在不同分辨率上显示时,其内容应适当排列,不会重叠。 +5. 当插件在任何支持的分辨率上显示时,滚动条应仅在必要时出现。 diff --git a/.vscode/settings.json b/.vscode/settings.json index 013007b..6f6ed1e 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,3 +1,4 @@ { - "dotnet.preferCSharpExtension": true + "dotnet.preferCSharpExtension": true, + "dotnet.defaultSolution": "NavisworksTransport.sln" } \ No newline at end of file diff --git a/src/MainPlugin.cs b/src/MainPlugin.cs index b3f4f2a..afbe294 100644 --- a/src/MainPlugin.cs +++ b/src/MainPlugin.cs @@ -459,7 +459,7 @@ namespace NavisworksTransport { Text = "关闭", Size = new Size(60, 30), - Location = new Point(330, 10), + Location = new Point(320, 10), Font = new Font("微软雅黑", 8) }; bottomPanel.Controls.Add(closeButton); @@ -553,7 +553,7 @@ namespace NavisworksTransport Text = "请在主界面中点击选择模型", Font = new Font("微软雅黑", 8, FontStyle.Bold), ForeColor = System.Drawing.Color.Orange, - AutoSize = true, + AutoSize = true, Location = new Point(10, currentY) }; scrollPanel.Controls.Add(_instructionLabel); @@ -590,7 +590,7 @@ namespace NavisworksTransport { Text = "物流模型列表", Location = new Point(10, currentY), - Size = new Size(350, 185), + Size = new Size(350, 195), Font = new Font("微软雅黑", 8, FontStyle.Bold) }; scrollPanel.Controls.Add(logisticsListGroupBox); @@ -608,14 +608,14 @@ namespace NavisworksTransport }; scrollPanel.Controls.Add(_statsLabel); UpdateLogisticsStatsStatic(_statsLabel); - currentY += 25; + currentY += 30; // 可见性控制 GroupBox visibilityGroupBox = new GroupBox { Text = "可见性控制", Location = new Point(10, currentY), - Size = new Size(350, 100), + Size = new Size(350, 95), Font = new Font("微软雅黑", 8, FontStyle.Bold) }; scrollPanel.Controls.Add(visibilityGroupBox); @@ -759,24 +759,24 @@ namespace NavisworksTransport { Text = "模型分层拆分", Location = new Point(10, currentY), - Size = new Size(350, 80), + Size = new Size(350, 100), Font = new Font("微软雅黑", 8, FontStyle.Bold) }; scrollPanel.Controls.Add(splitterGroupBox); CreateModelSplitterControls(splitterGroupBox); - currentY += 100; + currentY += 120; // 日志管理 GroupBox logGroupBox = new GroupBox { Text = "日志管理", Location = new Point(10, currentY), - Size = new Size(350, 120), + Size = new Size(350, 100), Font = new Font("微软雅黑", 8, FontStyle.Bold) }; scrollPanel.Controls.Add(logGroupBox); CreateLogManagementControls(logGroupBox); - currentY += 140; + currentY += 120; // 插件设置 GroupBox settingsGroupBox = new GroupBox @@ -840,8 +840,8 @@ namespace NavisworksTransport { Text = "将大型模型按楼层或属性拆分为多个文件", Location = new Point(15, 60), - Size = new Size(320, 15), - Font = new Font("微软雅黑", 7), + AutoSize = true, + Font = new Font("微软雅黑", 8), ForeColor = System.Drawing.Color.Gray }; groupBox.Controls.Add(infoLabel); @@ -857,7 +857,7 @@ namespace NavisworksTransport { Text = "新建", Location = new Point(15, 25), - Size = new Size(60, 25), + Size = new Size(60, 30), Font = new Font("微软雅黑", 8) }; groupBox.Controls.Add(newButton); @@ -866,7 +866,7 @@ namespace NavisworksTransport { Text = "详情", Location = new Point(85, 25), - Size = new Size(60, 25), + Size = new Size(60, 30), Font = new Font("微软雅黑", 8) }; groupBox.Controls.Add(detailButton); @@ -875,7 +875,7 @@ namespace NavisworksTransport { Text = "编辑", Location = new Point(155, 25), - Size = new Size(60, 25), + Size = new Size(60, 30), Font = new Font("微软雅黑", 8) }; groupBox.Controls.Add(editButton); @@ -884,7 +884,7 @@ namespace NavisworksTransport { Text = "删除", Location = new Point(225, 25), - Size = new Size(60, 25), + Size = new Size(60, 30), Font = new Font("微软雅黑", 8) }; groupBox.Controls.Add(deleteButton); @@ -1039,7 +1039,7 @@ namespace NavisworksTransport { Text = "状态: 查看模式", Location = new Point(15, 25), - Size = new Size(200, 20), + AutoSize = true, Font = new Font("微软雅黑", 8), ForeColor = System.Drawing.Color.Blue }; @@ -1050,7 +1050,7 @@ namespace NavisworksTransport { Text = "在3D视图中点击物流通道设置路径点", Location = new Point(15, 50), - Size = new Size(290, 20), + AutoSize = true, Font = new Font("微软雅黑", 8), ForeColor = System.Drawing.Color.Gray }; @@ -1061,7 +1061,7 @@ namespace NavisworksTransport { Text = "路径点列表:", Location = new Point(15, 80), - Size = new Size(80, 20), + AutoSize = true, Font = new Font("微软雅黑", 8) }; groupBox.Controls.Add(pointsLabel); @@ -1077,7 +1077,7 @@ namespace NavisworksTransport }; // 添加列 - _currentPathPointsListView.Columns.Add("序号", 40, HorizontalAlignment.Left); + _currentPathPointsListView.Columns.Add("序号", 60, HorizontalAlignment.Left); _currentPathPointsListView.Columns.Add("名称", 80, HorizontalAlignment.Left); _currentPathPointsListView.Columns.Add("类型", 60, HorizontalAlignment.Left); _currentPathPointsListView.Columns.Add("坐标 (X,Y,Z)", 120, HorizontalAlignment.Left); @@ -1088,8 +1088,8 @@ namespace NavisworksTransport Button finishButton = new Button { Text = "完成编辑", - Location = new Point(95, 215), - Size = new Size(80, 25), + Location = new Point(75, 215), + Size = new Size(100, 30), Font = new Font("微软雅黑", 8), Enabled = false }; @@ -1099,7 +1099,7 @@ namespace NavisworksTransport { Text = "取消编辑", Location = new Point(185, 215), - Size = new Size(80, 25), + Size = new Size(100, 30), Font = new Font("微软雅黑", 8), Enabled = false }; @@ -1198,36 +1198,36 @@ namespace NavisworksTransport { Button saveButton = new Button { - Text = "保存路径", - Location = new Point(15, 25), - Size = new Size(70, 30), + Text = "保存", + Location = new Point(15, 30), + Size = new Size(60, 30), Font = new Font("微软雅黑", 8) }; groupBox.Controls.Add(saveButton); Button importButton = new Button { - Text = "导入路径", - Location = new Point(95, 25), - Size = new Size(70, 30), + Text = "导入", + Location = new Point(85, 30), + Size = new Size(60, 30), Font = new Font("微软雅黑", 8) }; groupBox.Controls.Add(importButton); Button exportButton = new Button { - Text = "导出路径", - Location = new Point(175, 25), - Size = new Size(70, 30), + Text = "导出", + Location = new Point(155, 30), + Size = new Size(60, 30), Font = new Font("微软雅黑", 8) }; groupBox.Controls.Add(exportButton); Button historyButton = new Button { - Text = "查看历史", - Location = new Point(255, 25), - Size = new Size(70, 30), + Text = "历史", + Location = new Point(225, 30), + Size = new Size(60, 30), Font = new Font("微软雅黑", 8) }; groupBox.Controls.Add(historyButton); @@ -1436,7 +1436,7 @@ namespace NavisworksTransport { _startAnimationButton.Text = "▶ 播放"; _startAnimationButton.Location = new Point(15, 25); - _startAnimationButton.Size = new Size(70, 30); + _startAnimationButton.Size = new Size(80, 30); groupBox.Controls.Add(_startAnimationButton); } @@ -1444,8 +1444,8 @@ namespace NavisworksTransport if (_stopAnimationButton != null) { _stopAnimationButton.Text = "⏹ 停止"; - _stopAnimationButton.Location = new Point(95, 25); - _stopAnimationButton.Size = new Size(70, 30); + _stopAnimationButton.Location = new Point(105, 25); + _stopAnimationButton.Size = new Size(80, 30); groupBox.Controls.Add(_stopAnimationButton); } @@ -1768,7 +1768,7 @@ namespace NavisworksTransport // 创建列表视图(保存引用) _logisticsListView = new ListView { - Location = new Point(10, 20), + Location = new Point(10, 25), Size = new Size(320, 120), View = System.Windows.Forms.View.Details, FullRowSelect = true, @@ -1786,7 +1786,7 @@ namespace NavisworksTransport Button editButton = new Button { Text = "修改类别", - Size = new Size(80, 25), + Size = new Size(100, 30), Location = new Point(10, 150), Font = new Font("微软雅黑", 8) }; @@ -1795,8 +1795,8 @@ namespace NavisworksTransport Button clearButton = new Button { Text = "清除属性", - Size = new Size(80, 25), - Location = new Point(100, 150), + Size = new Size(100, 30), + Location = new Point(120, 150), Font = new Font("微软雅黑", 8) }; parent.Controls.Add(clearButton); @@ -1804,8 +1804,8 @@ namespace NavisworksTransport Button highlightButton = new Button { Text = "高亮显示", - Size = new Size(80, 25), - Location = new Point(190, 150), + Size = new Size(100, 30), + Location = new Point(230, 150), Font = new Font("微软雅黑", 8) }; parent.Controls.Add(highlightButton); @@ -1830,6 +1830,7 @@ namespace NavisworksTransport { Text = "启用碰撞检测", Location = new Point(15, 25), + Size = new Size(140, 30), Checked = true, Font = new Font("微软雅黑", 8) }; @@ -1838,7 +1839,8 @@ namespace NavisworksTransport CheckBox highlightCheckBox = new CheckBox { Text = "高亮显示碰撞", - Location = new Point(150, 25), + Location = new Point(165, 25), + Size = new Size(140, 30), Checked = true, Font = new Font("微软雅黑", 8) }; @@ -1854,7 +1856,7 @@ namespace NavisworksTransport { Text = "查看日志", Location = new Point(15, 25), - Size = new Size(80, 30), + Size = new Size(100, 30), Font = new Font("微软雅黑", 8) }; groupBox.Controls.Add(viewLogButton); @@ -1862,8 +1864,8 @@ namespace NavisworksTransport Button clearLogButton = new Button { Text = "清空日志", - Location = new Point(105, 25), - Size = new Size(80, 30), + Location = new Point(125, 25), + Size = new Size(100, 30), Font = new Font("微软雅黑", 8) }; groupBox.Controls.Add(clearLogButton); @@ -1871,8 +1873,8 @@ namespace NavisworksTransport Button exportLogButton = new Button { Text = "导出日志", - Location = new Point(195, 25), - Size = new Size(80, 30), + Location = new Point(235, 25), + Size = new Size(100, 30), Font = new Font("微软雅黑", 8) }; groupBox.Controls.Add(exportLogButton); @@ -1892,7 +1894,7 @@ namespace NavisworksTransport { Text = "日志级别:", Location = new Point(145, 68), - Size = new Size(60, 20), + AutoSize = true, Font = new Font("微软雅黑", 8) }; groupBox.Controls.Add(logLevelLabel); @@ -1929,7 +1931,8 @@ namespace NavisworksTransport CheckBox autoSaveCheckBox = new CheckBox { Text = "自动保存路径", - Location = new Point(15, 25), + Location = new Point(15, 30), + Size = new Size(125, 30), Font = new Font("微软雅黑", 8) }; groupBox.Controls.Add(autoSaveCheckBox); @@ -1937,7 +1940,8 @@ namespace NavisworksTransport CheckBox debugModeCheckBox = new CheckBox { Text = "调试模式", - Location = new Point(150, 25), + Location = new Point(150, 30), + Size = new Size(125, 30), Font = new Font("微软雅黑", 8) }; groupBox.Controls.Add(debugModeCheckBox); @@ -1945,8 +1949,8 @@ namespace NavisworksTransport Button resetSettingsButton = new Button { Text = "重置设置", - Location = new Point(15, 55), - Size = new Size(80, 25), + Location = new Point(15, 60), + Size = new Size(100, 30), Font = new Font("微软雅黑", 8) }; groupBox.Controls.Add(resetSettingsButton); @@ -1961,7 +1965,7 @@ namespace NavisworksTransport { Text = "插件版本: v1.0", Location = new Point(15, 25), - Size = new Size(150, 20), + AutoSize = true, Font = new Font("微软雅黑", 8) }; groupBox.Controls.Add(versionLabel); @@ -1970,7 +1974,7 @@ namespace NavisworksTransport { Text = $"Navisworks版本: {NavisApplication.Version}", Location = new Point(15, 50), - Size = new Size(200, 20), + AutoSize = true, Font = new Font("微软雅黑", 8) }; groupBox.Controls.Add(navisVersionLabel); @@ -1979,7 +1983,7 @@ namespace NavisworksTransport { Text = $"操作系统: {Environment.OSVersion}", Location = new Point(15, 75), - Size = new Size(300, 20), + AutoSize = true, Font = new Font("微软雅黑", 8) }; groupBox.Controls.Add(osLabel); @@ -1988,7 +1992,7 @@ namespace NavisworksTransport { Text = $"内存使用: {GC.GetTotalMemory(false) / 1024 / 1024} MB", Location = new Point(15, 100), - Size = new Size(200, 20), + AutoSize = true, Font = new Font("微软雅黑", 8) }; groupBox.Controls.Add(memoryLabel); @@ -1996,8 +2000,8 @@ namespace NavisworksTransport Button refreshInfoButton = new Button { Text = "刷新信息", - Location = new Point(15, 120), - Size = new Size(80, 25), + Location = new Point(15, 125), + Size = new Size(100, 30), Font = new Font("微软雅黑", 8) }; groupBox.Controls.Add(refreshInfoButton); @@ -2125,17 +2129,17 @@ namespace NavisworksTransport // 类别标签 Label categoryLabel = new Label { - Text = "设为类型:", + Text = "设为类别:", Location = new Point(10, 30), - Size = new Size(60, 20), - Font = new Font("微软雅黑", 8) + Font = new Font("微软雅黑", 8), + AutoSize = true }; parent.Controls.Add(categoryLabel); // 类别下拉框 ComboBox categoryComboBox = new ComboBox { - Location = new Point(80, 25), + Location = new Point(100, 25), Size = new Size(100, 25), Font = new Font("微软雅黑", 8), DropDownStyle = ComboBoxStyle.DropDownList @@ -2158,8 +2162,8 @@ namespace NavisworksTransport Button applyButton = new Button { Text = "应用类别", - Location = new Point(200, 25), - Size = new Size(80, 25), + Location = new Point(220, 25), + Size = new Size(100, 30), Font = new Font("微软雅黑", 8), UseVisualStyleBackColor = true }; @@ -2251,7 +2255,7 @@ namespace NavisworksTransport { Text = "请在选择树中选择部件", Location = new Point(15, 25), - Size = new Size(140, 20), + AutoSize = true, Font = new Font("微软雅黑", 8), ForeColor = System.Drawing.Color.Blue }; @@ -2259,8 +2263,8 @@ namespace NavisworksTransport Button getVehicleButton = new Button { Text = "获取选中部件", - Location = new Point(180, 22), - Size = new Size(85, 27), + Location = new Point(205, 22), + Size = new Size(85, 30), Font = new Font("微软雅黑", 8) }; @@ -2268,7 +2272,7 @@ namespace NavisworksTransport { Text = "状态: 未选择", Location = new Point(15, 55), - Size = new Size(290, 20), + AutoSize = true, Font = new Font("微软雅黑", 8), ForeColor = System.Drawing.Color.Gray }; @@ -2278,13 +2282,13 @@ namespace NavisworksTransport { Text = "路径选择:", Location = new Point(15, 80), - Size = new Size(70, 20), + AutoSize = true, Font = new Font("微软雅黑", 8) }; ComboBox pathComboBox = new ComboBox { - Location = new Point(85, 78), + Location = new Point(105, 78), Size = new Size(120, 25), Font = new Font("微软雅黑", 8), DropDownStyle = ComboBoxStyle.DropDownList, @@ -2294,34 +2298,25 @@ namespace NavisworksTransport Label pathInfoLabel = new Label { Text = "点数: 0", - Location = new Point(215, 82), - Size = new Size(50, 20), + Location = new Point(235, 82), + AutoSize = true, Font = new Font("微软雅黑", 8), ForeColor = System.Drawing.Color.Gray }; - Button refreshPathButton = new Button - { - Text = "刷新", - Location = new Point(270, 78), - Size = new Size(45, 25), - Font = new Font("微软雅黑", 8), - UseVisualStyleBackColor = true - }; - // 动画持续时间设置 Label durationLabel = new Label { Text = "动画时长(秒):", Location = new Point(15, 115), - Size = new Size(80, 20), + AutoSize = true, Font = new Font("微软雅黑", 8) }; NumericUpDown durationNumeric = new NumericUpDown { - Location = new Point(100, 113), - Size = new Size(55, 25), + Location = new Point(135, 113), + Size = new Size(90, 25), Font = new Font("微软雅黑", 8), Minimum = 1, Maximum = 300, @@ -2333,8 +2328,8 @@ namespace NavisworksTransport Button createAnimationButton = new Button { Text = "生成动画", - Location = new Point(180, 112), - Size = new Size(85, 27), + Location = new Point(235, 112), + Size = new Size(100,30), Font = new Font("微软雅黑", 8), Enabled = false }; @@ -2343,8 +2338,8 @@ namespace NavisworksTransport _startAnimationButton = new Button { Text = "播放", - Location = new Point(245, 107), - Size = new Size(55, 27), + Location = new Point(15, 110), + Size = new Size(80, 30), Font = new Font("微软雅黑", 8), Enabled = false }; @@ -2352,8 +2347,8 @@ namespace NavisworksTransport _stopAnimationButton = new Button { Text = "停止", - Location = new Point(15, 140), - Size = new Size(55, 27), + Location = new Point(105, 110), + Size = new Size(80, 30), Font = new Font("微软雅黑", 8), Enabled = false }; @@ -2362,8 +2357,8 @@ namespace NavisworksTransport _animationStatusLabel = new Label { Text = "状态: 未生成动画", - Location = new Point(80, 144), - Size = new Size(150, 20), + Location = new Point(80, 145), + AutoSize = true, Font = new Font("微软雅黑", 8), ForeColor = System.Drawing.Color.Gray }; @@ -2516,16 +2511,6 @@ namespace NavisworksTransport }; } - // 刷新路径按钮事件处理 - refreshPathButton.Click += (sender, e) => - { - GlobalExceptionHandler.SafeExecute(() => - { - refreshPathList(); - MessageBox.Show("路径列表已刷新", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information); - }, "刷新路径列表"); - }; - // 生成动画事件处理 createAnimationButton.Click += (sender, e) => { @@ -2619,7 +2604,6 @@ namespace NavisworksTransport parent.Controls.Add(pathLabel); parent.Controls.Add(pathComboBox); parent.Controls.Add(pathInfoLabel); - parent.Controls.Add(refreshPathButton); parent.Controls.Add(durationLabel); parent.Controls.Add(durationNumeric); parent.Controls.Add(createAnimationButton); @@ -2696,7 +2680,7 @@ namespace NavisworksTransport CheckBox logisticsOnlyCheckBox = new CheckBox { Text = "只显示物流分类项目", - Size = new Size(200, 20), + Size = new Size(200, 25), Location = new Point(20, 30), Font = new Font("微软雅黑", 8), Checked = false, @@ -2707,8 +2691,8 @@ namespace NavisworksTransport Label statusLabel = new Label { Text = "状态: 显示所有项目", - Location = new Point(20, 70), - Size = new Size(250, 20), + Location = new Point(20, 60), + AutoSize = true, Font = new Font("微软雅黑", 8), ForeColor = System.Drawing.Color.DarkGreen }; diff --git a/src/ModelSplitterDialog.cs b/src/ModelSplitterDialog.cs index 3f17b78..d7c2782 100644 --- a/src/ModelSplitterDialog.cs +++ b/src/ModelSplitterDialog.cs @@ -132,7 +132,7 @@ namespace NavisworksTransport { Text = "浏览...", Font = new Font("微软雅黑", 8), - Size = new Size(80, 25) + Size = new Size(80, 30) }; // 文件命名模式 @@ -387,14 +387,14 @@ namespace NavisworksTransport // 进度条和状态 _progressBar.Location = new Point(margin, currentY); _progressBar.Size = new Size(500, 20); - _statusLabel.Location = new Point(margin + 510, currentY + 2); + _statusLabel.Location = new Point(margin + 500, currentY + 2); currentY += 25 + spacing; // 按钮 _helpButton.Location = new Point(margin, currentY); - _previewButton.Location = new Point(this.Width - 320, currentY); - _executeButton.Location = new Point(this.Width - 210, currentY); - _cancelButton.Location = new Point(this.Width - 100, currentY); + _previewButton.Location = new Point(this.Width - 330, currentY); + _executeButton.Location = new Point(this.Width - 220, currentY); + _cancelButton.Location = new Point(this.Width - 110, currentY); } private void AttachEventHandlers()