优化区域编号计算逻辑,确保绘制状态下正确显示和分配下一个区域编号

This commit is contained in:
zqm
2025-11-11 16:44:34 +08:00
parent d91b8d6454
commit 491eda919b
4 changed files with 41 additions and 227 deletions

View File

@@ -94,128 +94,6 @@
<div class="vs-content"> <div class="vs-content">
<!-- 这里是内容区域使用slot接收子组件并监听Panel的maximize事件 --> <!-- 这里是内容区域使用slot接收子组件并监听Panel的maximize事件 -->
<slot @maximize="onPanelMaximize"></slot> <slot @maximize="onPanelMaximize"></slot>
<!-- 1. 定义可复用组件symbol封装所有渐变和路径只写一次 -->
<svg width="0" height="0" viewBox="0 0 40 40" aria-hidden="true">
<defs>
<!-- 渐变定义共用只写一次 -->
<linearGradient
id="lightGradient"
x1="0%" y1="0%" x2="100%" y2="100%">
<stop offset="0%" stop-color="#DCE3F5" />
<stop offset="100%" stop-color="#B7BED1" />
</linearGradient>
<linearGradient
id="Area"
x1="50%" y1="0%" x2="50%" y2="100%">
<stop offset="0%" stop-color="#F0E2BC" />
<stop offset="100%" stop-color="#B09556" />
</linearGradient>
</defs>
<!-- 封装所有图形为 symbolid 用于后续调用 -->
<symbol id="shared-border" viewBox="0 0 40 40">
<path
fill="#61697E"
fill-rule="evenodd"
clip-rule="evenodd"
d="M0 0 L40 0 L40 40 L0 40 Z M1 1 L39 1 L39 39 L1 39 Z" />
<path
fill="#A1A9C4"
fill-rule="evenodd"
clip-rule="evenodd"
d="M1 1 L39 1 L39 39 L1 39 Z M4 5 L5 4 L35 4 L36 5 L36 35 L35 36 L5 36 L4 35 Z" />
<path
fill="#7E869C"
fill-rule="evenodd"
clip-rule="evenodd"
d="M4 5 L5 4 L35 4 L36 5 L36 35 L35 36 L5 36 L4 35 Z M6 7 L7 6 L33 6 L34 7 L34 33 L33 34 L7 34 L6 33 Z" />
<path
fill="url(#lightGradient)"
fill-rule="evenodd"
clip-rule="evenodd"
d="M6 7 L7 6 L33 6 L34 7 L34 33 L33 34 L7 34 L6 33 Z" />
</symbol>
<symbol id="shared-icon" viewBox="0 0 40 40">
<use xlink:href="#shared-border" />
<path
fill="#4C5E83"
fill-rule="evenodd"
clip-rule="evenodd"
d="M16 30 L20 26 L23 30 Z" />
</symbol>
</svg>
<!-- 2. 第一个 SVG不旋转直接调用共用组件 -->
<svg width="41" height="41" viewBox="0 0 40 40" aria-hidden="true">
<use xlink:href="#shared-icon" />
<path
fill="#4C5E83"
fill-rule="evenodd"
clip-rule="evenodd"
d="M8 8 L32 8 L32 20 L31 21 L9 21 L8 20 Z" />
<path
fill="url(#Area)"
fill-rule="evenodd"
clip-rule="evenodd"
d="M10 13 L30 13 L30 19 L10 19 Z" />
</svg>
<!-- 3. 第二个 SVG旋转90度调用同一共用组件 -->
<svg width="41" height="41" viewBox="0 0 40 40" aria-hidden="true">
<use xlink:href="#shared-icon" transform="rotate(90 20 20)" />
<path
fill="#4C5E83"
fill-rule="evenodd"
clip-rule="evenodd"
d="M19 8 L32 8 L32 31 L31 32 L20 32 L19 31 Z" />
<path
fill="url(#Area)"
fill-rule="evenodd"
clip-rule="evenodd"
d="M21 14 L30 14 L30 30 L21 30 Z" />
</svg>
<!-- 4. 第三个 SVG旋转180度调用同一共用组件 -->
<svg width="41" height="41" viewBox="0 0 40 40" aria-hidden="true">
<use xlink:href="#shared-icon" transform="rotate(180 20 20)" />
<path
fill="#4C5E83"
fill-rule="evenodd"
clip-rule="evenodd"
d="M8 19 L32 19 L32 31 L31 32 L9 32 L8 31 Z" />
<path
fill="url(#Area)"
fill-rule="evenodd"
clip-rule="evenodd"
d="M10 24 L30 24 L30 30 L10 30 Z" />
</svg>
<!-- 5. 第四个 SVG旋转270度调用同一共用组件 -->
<svg width="41" height="41" viewBox="0 0 40 40" aria-hidden="true">
<use xlink:href="#shared-icon" transform="rotate(270 20 20)" />
<path
fill="#4C5E83"
fill-rule="evenodd"
clip-rule="evenodd"
d="M8 8 L21 8 L21 31 L19 32 L9 32 L8 31 Z" />
<path
fill="url(#Area)"
fill-rule="evenodd"
clip-rule="evenodd"
d="M10 14 L19 14 L19 30 L10 30 Z" />
</svg>
<!-- 6. 第五个 SVG正中的按钮调用同一共用组件 -->
<svg width="41" height="41" viewBox="0 0 40 40" aria-hidden="true">
<use xlink:href="#shared-border" transform="rotate(270 20 20)" />
<path
fill="#4C5E83"
fill-rule="evenodd"
clip-rule="evenodd"
d="M8 8 L32 8 L32 31 L31 32 L9 32 L8 31 Z" />
<path
fill="url(#Area)"
fill-rule="evenodd"
clip-rule="evenodd"
d="M10 14 L30 14 L30 30 L10 30 Z" />
</svg>
</div> </div>
</div> </div>
</template> </template>

View File

@@ -185,14 +185,14 @@
1. 初始状态/就绪状态: 1. 初始状态/就绪状态:
- 显示btnDrawRegion和btnDrawTempDiff按钮、dataGridViewTempDiff - 显示btnDrawRegion和btnDrawTempDiff按钮、dataGridViewTempDiff
- 显示btnNewTempRegion按钮、btnLoadTempRegion按钮、btnSaveTempRegion按钮、btnNewTempDiff按钮、btnLoadTempDiff按钮、btnSaveTempDiff按钮 - 显示btnNewTempRegion按钮、btnLoadTempRegion按钮、btnSaveTempRegion按钮、btnNewTempDiff按钮、btnLoadTempDiff按钮、btnSaveTempDiff按钮
- 隐藏btnSelectColor、btnDeleteRegion按钮、btnAddTempDiff、btnDeleteTempDiff、btnBrushSize1、btnBrushSize3、btnBrushSize5、btnBrushSize10、btnBrushSize15、btnBrushSize25 - 隐藏btnSelectColor、btnDeleteRegion按钮、btnAddTempDiff、btnDeleteTempDiff、btnBrushSize1、btnBrushSize3、btnBrushSize5、btnBrushSize10、btnBrushSize15、btnBrushSize25、txtRegionNumber
2. 选中区域状态: 2. 选中区域状态:
- 显示btnDeleteRegion和btnSelectColor按钮 - 显示btnDeleteRegion和btnSelectColor按钮、txtRegionNumber
- 隐藏btnDrawRegion和btnDrawTempDiff按钮、dataGridViewTempDiff、btnAddTempDiff、btnDeleteTempDiff、btnBrushSize1、btnBrushSize3、btnBrushSize5、btnBrushSize10、btnBrushSize15、btnBrushSize25 - 隐藏btnDrawRegion和btnDrawTempDiff按钮、dataGridViewTempDiff、btnAddTempDiff、btnDeleteTempDiff、btnBrushSize1、btnBrushSize3、btnBrushSize5、btnBrushSize10、btnBrushSize15、btnBrushSize25
- 隐藏btnNewTempRegion按钮、btnLoadTempRegion按钮、btnSaveTempRegion按钮、btnNewTempDiff按钮、btnLoadTempDiff按钮、btnSaveTempDiff按钮 - 隐藏btnNewTempRegion按钮、btnLoadTempRegion按钮、btnSaveTempRegion按钮、btnNewTempDiff按钮、btnLoadTempDiff按钮、btnSaveTempDiff按钮
3. 绘制状态: 3. 绘制状态:
- 显示btnSelectColor按钮 - 显示btnSelectColor按钮
- 显示btnDrawRegion按钮 - 显示btnDrawRegion按钮、txtRegionNumber
- 隐藏btnDeleteRegion按钮 - 隐藏btnDeleteRegion按钮
- 隐藏btnDrawTempDiff按钮、dataGridViewTempDiff、btnAddTempDiff、btnDeleteTempDiff、btnBrushSize1、btnBrushSize3、btnBrushSize5、btnBrushSize10、btnBrushSize15、btnBrushSize25 - 隐藏btnDrawTempDiff按钮、dataGridViewTempDiff、btnAddTempDiff、btnDeleteTempDiff、btnBrushSize1、btnBrushSize3、btnBrushSize5、btnBrushSize10、btnBrushSize15、btnBrushSize25
- 隐藏btnNewTempRegion按钮、btnLoadTempRegion按钮、btnSaveTempRegion按钮、btnNewTempDiff按钮、btnLoadTempDiff按钮、btnSaveTempDiff按钮 - 隐藏btnNewTempRegion按钮、btnLoadTempRegion按钮、btnSaveTempRegion按钮、btnNewTempDiff按钮、btnLoadTempDiff按钮、btnSaveTempDiff按钮

View File

@@ -38,6 +38,7 @@ namespace JoyD.Windows.CS
this.btnSelectColor = new System.Windows.Forms.ToolStripButton(); this.btnSelectColor = new System.Windows.Forms.ToolStripButton();
this.btnDeleteRegion = new System.Windows.Forms.ToolStripButton(); this.btnDeleteRegion = new System.Windows.Forms.ToolStripButton();
this.btnDrawTempDiff = new System.Windows.Forms.ToolStripButton(); this.btnDrawTempDiff = new System.Windows.Forms.ToolStripButton();
this.btnEraseTempDiff = new System.Windows.Forms.ToolStripButton();
this.btnAddTempDiff = new System.Windows.Forms.ToolStripButton(); this.btnAddTempDiff = new System.Windows.Forms.ToolStripButton();
this.btnDeleteTempDiff = new System.Windows.Forms.ToolStripButton(); this.btnDeleteTempDiff = new System.Windows.Forms.ToolStripButton();
this.btnBrushSize1 = new System.Windows.Forms.ToolStripButton(); this.btnBrushSize1 = new System.Windows.Forms.ToolStripButton();
@@ -46,7 +47,13 @@ namespace JoyD.Windows.CS
this.btnBrushSize10 = new System.Windows.Forms.ToolStripButton(); this.btnBrushSize10 = new System.Windows.Forms.ToolStripButton();
this.btnBrushSize15 = new System.Windows.Forms.ToolStripButton(); this.btnBrushSize15 = new System.Windows.Forms.ToolStripButton();
this.btnBrushSize25 = new System.Windows.Forms.ToolStripButton(); this.btnBrushSize25 = new System.Windows.Forms.ToolStripButton();
this.btnEraseTempDiff = new System.Windows.Forms.ToolStripButton(); this.txtRegionNumber = new System.Windows.Forms.ToolStripTextBox();
this.btnNewTempRegion = new System.Windows.Forms.ToolStripButton();
this.btnLoadTempRegion = new System.Windows.Forms.ToolStripButton();
this.btnSaveTempRegion = new System.Windows.Forms.ToolStripButton();
this.btnNewTempDiff = new System.Windows.Forms.ToolStripButton();
this.btnLoadTempDiff = new System.Windows.Forms.ToolStripButton();
this.btnSaveTempDiff = new System.Windows.Forms.ToolStripButton();
((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
this.splitContainer.Panel1.SuspendLayout(); this.splitContainer.Panel1.SuspendLayout();
this.splitContainer.Panel2.SuspendLayout(); this.splitContainer.Panel2.SuspendLayout();
@@ -100,10 +107,10 @@ namespace JoyD.Windows.CS
this.picBoxTemp.SizeChanged += new System.EventHandler(this.PicBoxTemp_SizeChanged); this.picBoxTemp.SizeChanged += new System.EventHandler(this.PicBoxTemp_SizeChanged);
this.picBoxTemp.Paint += new System.Windows.Forms.PaintEventHandler(this.PicBoxTemp_Paint); this.picBoxTemp.Paint += new System.Windows.Forms.PaintEventHandler(this.PicBoxTemp_Paint);
this.picBoxTemp.MouseClick += new System.Windows.Forms.MouseEventHandler(this.PicBoxTemp_MouseClick); this.picBoxTemp.MouseClick += new System.Windows.Forms.MouseEventHandler(this.PicBoxTemp_MouseClick);
this.picBoxTemp.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.PicBoxTemp_MouseDoubleClick);
this.picBoxTemp.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PicBoxTemp_MouseDown); this.picBoxTemp.MouseDown += new System.Windows.Forms.MouseEventHandler(this.PicBoxTemp_MouseDown);
this.picBoxTemp.MouseMove += new System.Windows.Forms.MouseEventHandler(this.PicBoxTemp_MouseMove); this.picBoxTemp.MouseMove += new System.Windows.Forms.MouseEventHandler(this.PicBoxTemp_MouseMove);
this.picBoxTemp.MouseUp += new System.Windows.Forms.MouseEventHandler(this.PicBoxTemp_MouseUp); this.picBoxTemp.MouseUp += new System.Windows.Forms.MouseEventHandler(this.PicBoxTemp_MouseUp);
this.picBoxTemp.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.PicBoxTemp_MouseDoubleClick);
// //
// toolStripContainer // toolStripContainer
// //
@@ -136,87 +143,6 @@ namespace JoyD.Windows.CS
this.dataGridViewTempDiff.Size = new System.Drawing.Size(250, 400); this.dataGridViewTempDiff.Size = new System.Drawing.Size(250, 400);
this.dataGridViewTempDiff.TabIndex = 0; this.dataGridViewTempDiff.TabIndex = 0;
// //
// btnNewTempRegion
//
this.btnNewTempRegion = new System.Windows.Forms.ToolStripButton();
this.btnNewTempRegion.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.btnNewTempRegion.ImageTransparentColor = System.Drawing.Color.Magenta;
this.btnNewTempRegion.Name = "btnNewTempRegion";
this.btnNewTempRegion.Size = new System.Drawing.Size(23, 4);
this.btnNewTempRegion.Text = "新建测温区";
this.btnNewTempRegion.ToolTipText = "新建测温区";
this.btnNewTempRegion.Click += new System.EventHandler(this.BtnNewTempRegion_Click);
//
// btnLoadTempRegion
//
this.btnLoadTempRegion = new System.Windows.Forms.ToolStripButton();
this.btnLoadTempRegion.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.btnLoadTempRegion.ImageTransparentColor = System.Drawing.Color.Magenta;
this.btnLoadTempRegion.Name = "btnLoadTempRegion";
this.btnLoadTempRegion.Size = new System.Drawing.Size(23, 4);
this.btnLoadTempRegion.Text = "加载测温区";
this.btnLoadTempRegion.ToolTipText = "加载测温区";
this.btnLoadTempRegion.Click += new System.EventHandler(this.BtnLoadTempRegion_Click);
//
// btnSaveTempRegion
//
this.btnSaveTempRegion = new System.Windows.Forms.ToolStripButton();
this.btnSaveTempRegion.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.btnSaveTempRegion.ImageTransparentColor = System.Drawing.Color.Magenta;
this.btnSaveTempRegion.Name = "btnSaveTempRegion";
this.btnSaveTempRegion.Size = new System.Drawing.Size(23, 4);
this.btnSaveTempRegion.Text = "保存测温区";
this.btnSaveTempRegion.ToolTipText = "保存测温区";
this.btnSaveTempRegion.Click += new System.EventHandler(this.BtnSaveTempRegion_Click);
//
// btnNewTempDiff
//
this.btnNewTempDiff = new System.Windows.Forms.ToolStripButton();
this.btnNewTempDiff.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.btnNewTempDiff.ImageTransparentColor = System.Drawing.Color.Magenta;
this.btnNewTempDiff.Name = "btnNewTempDiff";
this.btnNewTempDiff.Size = new System.Drawing.Size(23, 4);
this.btnNewTempDiff.Text = "新建温差图";
this.btnNewTempDiff.ToolTipText = "新建温差图";
//
// btnLoadTempDiff
//
this.btnLoadTempDiff = new System.Windows.Forms.ToolStripButton();
this.btnLoadTempDiff.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.btnLoadTempDiff.ImageTransparentColor = System.Drawing.Color.Magenta;
this.btnLoadTempDiff.Name = "btnLoadTempDiff";
this.btnLoadTempDiff.Size = new System.Drawing.Size(23, 4);
this.btnLoadTempDiff.Text = "加载温差图";
this.btnLoadTempDiff.ToolTipText = "加载温差图";
//
// btnSaveTempDiff
//
this.btnSaveTempDiff = new System.Windows.Forms.ToolStripButton();
this.btnSaveTempDiff.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.btnSaveTempDiff.ImageTransparentColor = System.Drawing.Color.Magenta;
this.btnSaveTempDiff.Name = "btnSaveTempDiff";
this.btnSaveTempDiff.Size = new System.Drawing.Size(23, 4);
this.btnSaveTempDiff.Text = "保存温差图";
this.btnSaveTempDiff.ToolTipText = "保存温差图";
//
// 确保在添加到toolStrip前初始化以下控件
//
this.txtRegionNumber = new System.Windows.Forms.ToolStripTextBox();
this.txtRegionNumber.Name = "txtRegionNumber";
this.txtRegionNumber.Size = new System.Drawing.Size(60, 25);
this.txtRegionNumber.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TxtRegionNumber_KeyDown);
this.txtRegionNumber.TextChanged += new System.EventHandler(this.TxtRegionNumber_TextChanged);
// 设置合适的边距
this.txtRegionNumber.Margin = new System.Windows.Forms.Padding(0, 2, 3, 2);
// 添加工具提示信息
this.txtRegionNumber.ToolTipText = "区域编号";
// 确保控件不会被拆分到不同行
this.txtRegionNumber.AutoSize = true;
// 设置文本靠右显示
this.txtRegionNumber.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
this.txtRegionNumber.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// toolStrip // toolStrip
// //
this.toolStrip.AllowDrop = true; this.toolStrip.AllowDrop = true;
@@ -231,30 +157,23 @@ namespace JoyD.Windows.CS
this.btnEraseTempDiff, this.btnEraseTempDiff,
this.btnAddTempDiff, this.btnAddTempDiff,
this.btnDeleteTempDiff, this.btnDeleteTempDiff,
new System.Windows.Forms.ToolStripSeparator(),
this.btnBrushSize1, this.btnBrushSize1,
this.btnBrushSize3, this.btnBrushSize3,
this.btnBrushSize5, this.btnBrushSize5,
this.btnBrushSize10, this.btnBrushSize10,
this.btnBrushSize15, this.btnBrushSize15,
this.btnBrushSize25, this.btnBrushSize25,
new System.Windows.Forms.ToolStripSeparator(),
this.txtRegionNumber, this.txtRegionNumber,
new System.Windows.Forms.ToolStripSeparator(),
this.btnNewTempRegion, this.btnNewTempRegion,
this.btnLoadTempRegion, this.btnLoadTempRegion,
this.btnSaveTempRegion, this.btnSaveTempRegion,
this.btnNewTempDiff, this.btnNewTempDiff,
this.btnLoadTempDiff, this.btnLoadTempDiff,
this.btnSaveTempDiff}); this.btnSaveTempDiff});
// 使用Flow布局允许按钮多行显示
this.toolStrip.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow; this.toolStrip.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow;
this.toolStrip.Location = new System.Drawing.Point(3, 0); this.toolStrip.Location = new System.Drawing.Point(3, 0);
// 增加最大高度以允许多行显示
this.toolStrip.MaximumSize = new System.Drawing.Size(0, 200); this.toolStrip.MaximumSize = new System.Drawing.Size(0, 200);
this.toolStrip.MinimumSize = new System.Drawing.Size(100, 50); this.toolStrip.MinimumSize = new System.Drawing.Size(100, 50);
// 保留AutoSize以确保良好显示
this.toolStrip.AutoSize = true;
this.toolStrip.Name = "toolStrip"; this.toolStrip.Name = "toolStrip";
this.toolStrip.Padding = new System.Windows.Forms.Padding(5); this.toolStrip.Padding = new System.Windows.Forms.Padding(5);
this.toolStrip.Size = new System.Drawing.Size(247, 50); this.toolStrip.Size = new System.Drawing.Size(247, 50);
@@ -302,6 +221,16 @@ namespace JoyD.Windows.CS
this.btnDrawTempDiff.ToolTipText = "绘制温差图"; this.btnDrawTempDiff.ToolTipText = "绘制温差图";
this.btnDrawTempDiff.Click += new System.EventHandler(this.BtnDrawTempDiff_Click); this.btnDrawTempDiff.Click += new System.EventHandler(this.BtnDrawTempDiff_Click);
// //
// btnEraseTempDiff
//
this.btnEraseTempDiff.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
this.btnEraseTempDiff.ImageTransparentColor = System.Drawing.Color.Magenta;
this.btnEraseTempDiff.Name = "btnEraseTempDiff";
this.btnEraseTempDiff.Size = new System.Drawing.Size(23, 4);
this.btnEraseTempDiff.Text = "擦除温差图";
this.btnEraseTempDiff.ToolTipText = "使用透明色擦除温差图";
this.btnEraseTempDiff.Click += new System.EventHandler(this.BtnEraseTempDiff_Click);
//
// btnAddTempDiff // btnAddTempDiff
// //
this.btnAddTempDiff.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.btnAddTempDiff.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
@@ -382,15 +311,17 @@ namespace JoyD.Windows.CS
this.btnBrushSize25.ToolTipText = "选择25像素画笔"; this.btnBrushSize25.ToolTipText = "选择25像素画笔";
this.btnBrushSize25.Click += new System.EventHandler(this.BtnBrushSize25_Click); this.btnBrushSize25.Click += new System.EventHandler(this.BtnBrushSize25_Click);
// //
// btnEraseTempDiff // txtRegionNumber
// //
this.btnEraseTempDiff.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image; this.txtRegionNumber.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
this.btnEraseTempDiff.ImageTransparentColor = System.Drawing.Color.Magenta; this.txtRegionNumber.Margin = new System.Windows.Forms.Padding(0, 2, 3, 2);
this.btnEraseTempDiff.Name = "btnEraseTempDiff"; this.txtRegionNumber.Name = "txtRegionNumber";
this.btnEraseTempDiff.Size = new System.Drawing.Size(23, 4); this.txtRegionNumber.Size = new System.Drawing.Size(60, 27);
this.btnEraseTempDiff.Text = "擦除温差图"; this.txtRegionNumber.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.btnEraseTempDiff.ToolTipText = "使用透明色擦除温差图"; this.txtRegionNumber.TextBoxTextAlign = System.Windows.Forms.HorizontalAlignment.Right;
this.btnEraseTempDiff.Click += new System.EventHandler(this.BtnEraseTempDiff_Click); this.txtRegionNumber.ToolTipText = "区域编号";
this.txtRegionNumber.KeyDown += new System.Windows.Forms.KeyEventHandler(this.TxtRegionNumber_KeyDown);
this.txtRegionNumber.TextChanged += new System.EventHandler(this.TxtRegionNumber_TextChanged);
// //
// btnNewTempRegion // btnNewTempRegion
// //
@@ -400,6 +331,7 @@ namespace JoyD.Windows.CS
this.btnNewTempRegion.Size = new System.Drawing.Size(23, 4); this.btnNewTempRegion.Size = new System.Drawing.Size(23, 4);
this.btnNewTempRegion.Text = "新建测温区"; this.btnNewTempRegion.Text = "新建测温区";
this.btnNewTempRegion.ToolTipText = "新建测温区"; this.btnNewTempRegion.ToolTipText = "新建测温区";
this.btnNewTempRegion.Click += new System.EventHandler(this.BtnNewTempRegion_Click);
// //
// btnLoadTempRegion // btnLoadTempRegion
// //
@@ -409,6 +341,7 @@ namespace JoyD.Windows.CS
this.btnLoadTempRegion.Size = new System.Drawing.Size(23, 4); this.btnLoadTempRegion.Size = new System.Drawing.Size(23, 4);
this.btnLoadTempRegion.Text = "加载测温区"; this.btnLoadTempRegion.Text = "加载测温区";
this.btnLoadTempRegion.ToolTipText = "加载测温区"; this.btnLoadTempRegion.ToolTipText = "加载测温区";
this.btnLoadTempRegion.Click += new System.EventHandler(this.BtnLoadTempRegion_Click);
// //
// btnSaveTempRegion // btnSaveTempRegion
// //
@@ -418,6 +351,7 @@ namespace JoyD.Windows.CS
this.btnSaveTempRegion.Size = new System.Drawing.Size(23, 4); this.btnSaveTempRegion.Size = new System.Drawing.Size(23, 4);
this.btnSaveTempRegion.Text = "保存测温区"; this.btnSaveTempRegion.Text = "保存测温区";
this.btnSaveTempRegion.ToolTipText = "保存测温区"; this.btnSaveTempRegion.ToolTipText = "保存测温区";
this.btnSaveTempRegion.Click += new System.EventHandler(this.BtnSaveTempRegion_Click);
// //
// btnNewTempDiff // btnNewTempDiff
// //
@@ -445,7 +379,6 @@ namespace JoyD.Windows.CS
this.btnSaveTempDiff.Size = new System.Drawing.Size(23, 4); this.btnSaveTempDiff.Size = new System.Drawing.Size(23, 4);
this.btnSaveTempDiff.Text = "保存温差图"; this.btnSaveTempDiff.Text = "保存温差图";
this.btnSaveTempDiff.ToolTipText = "保存温差图"; this.btnSaveTempDiff.ToolTipText = "保存温差图";
// 控件初始化已移至toolStrip.Items.AddRange调用前
// //
// Setting // Setting
// //

View File

@@ -1124,9 +1124,11 @@ namespace JoyD.Windows.CS
btnSaveTempDiff.Visible = false; btnSaveTempDiff.Visible = false;
// 显示区域编号设置控件 // 显示区域编号设置控件
txtRegionNumber.Visible = true; txtRegionNumber.Visible = true;
// 在绘制状态下,显示下一个测温区的编号(当前已绘制数量 + 1 // 在绘制状态下,显示下一个测温区的编号(当前所有区域编号最大值 + 1
int nextRegionNumber = _drawnRectangles.Count + 1; int nextRegionNumber = _drawnRectangles.Count > 0 ? _drawnRectangles.Max(r => r.Index) + 1 : 1;
txtRegionNumber.Text = nextRegionNumber.ToString(); txtRegionNumber.Text = nextRegionNumber.ToString();
// 同步更新_regionCounter确保与显示的下一个编号一致
_regionCounter = nextRegionNumber - 1;
// 隐藏所有画笔大小按钮 // 隐藏所有画笔大小按钮
btnBrushSize1.Visible = false; btnBrushSize1.Visible = false;
btnBrushSize3.Visible = false; btnBrushSize3.Visible = false;
@@ -2316,6 +2318,7 @@ namespace JoyD.Windows.CS
int imageY = Math.Min(imageStartPoint.Y, imageEndPoint.Y); int imageY = Math.Min(imageStartPoint.Y, imageEndPoint.Y);
// 增加计数器并创建新的区域信息(存储图像坐标) // 增加计数器并创建新的区域信息(存储图像坐标)
// 保持简单的递增方式因为在UpdateButtonsVisibility方法中已经正确设置了下一个应该使用的编号
_regionCounter++; _regionCounter++;
RegionInfo regionInfo = new RegionInfo RegionInfo regionInfo = new RegionInfo
{ {