更新Toprie项目:将暂停图像更新功能改为暂停检测,移除mask层
This commit is contained in:
@@ -17,7 +17,6 @@ namespace JoyD.Windows.CS.Toprie
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.imageBox = new System.Windows.Forms.PictureBox();
|
||||
this.maskImageBox = new System.Windows.Forms.PictureBox();
|
||||
this.contextMenuStrip1 = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.imageModeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.thermalModeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
@@ -37,7 +36,7 @@ namespace JoyD.Windows.CS.Toprie
|
||||
this.redHotToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.rainbow2ToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
|
||||
this.pauseImageUpdateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.pauseDetectionToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
((System.ComponentModel.ISupportInitialize)(this.imageBox)).BeginInit();
|
||||
this.contextMenuStrip1.SuspendLayout();
|
||||
this.SuspendLayout();
|
||||
@@ -53,26 +52,13 @@ namespace JoyD.Windows.CS.Toprie
|
||||
this.imageBox.TabIndex = 0;
|
||||
this.imageBox.TabStop = false;
|
||||
//
|
||||
// maskImageBox
|
||||
//
|
||||
this.maskImageBox.ContextMenuStrip = this.contextMenuStrip1;
|
||||
this.maskImageBox.Dock = System.Windows.Forms.DockStyle.Fill;
|
||||
this.maskImageBox.Location = new System.Drawing.Point(0, 0);
|
||||
this.maskImageBox.Name = "maskImageBox";
|
||||
this.maskImageBox.Size = new System.Drawing.Size(512, 384);
|
||||
this.maskImageBox.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom;
|
||||
this.maskImageBox.TabIndex = 1;
|
||||
this.maskImageBox.TabStop = false;
|
||||
this.maskImageBox.BackColor = System.Drawing.Color.Transparent;
|
||||
this.maskImageBox.Visible = true;
|
||||
//
|
||||
// contextMenuStrip1
|
||||
//
|
||||
this.contextMenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.imageModeToolStripMenuItem,
|
||||
this.colorModeToolStripMenuItem,
|
||||
this.toolStripSeparator1,
|
||||
this.pauseImageUpdateToolStripMenuItem});
|
||||
this.pauseDetectionToolStripMenuItem});
|
||||
this.contextMenuStrip1.Name = "contextMenuStrip1";
|
||||
this.contextMenuStrip1.Size = new System.Drawing.Size(161, 100);
|
||||
//
|
||||
@@ -116,12 +102,12 @@ namespace JoyD.Windows.CS.Toprie
|
||||
this.toolStripSeparator1.Name = "toolStripSeparator1";
|
||||
this.toolStripSeparator1.Size = new System.Drawing.Size(157, 6);
|
||||
//
|
||||
// pauseImageUpdateToolStripMenuItem
|
||||
// pauseDetectionToolStripMenuItem
|
||||
//
|
||||
this.pauseImageUpdateToolStripMenuItem.Name = "pauseImageUpdateToolStripMenuItem";
|
||||
this.pauseImageUpdateToolStripMenuItem.Size = new System.Drawing.Size(160, 22);
|
||||
this.pauseImageUpdateToolStripMenuItem.Text = "暂停图像更新";
|
||||
this.pauseImageUpdateToolStripMenuItem.Click += new System.EventHandler(this.PauseImageUpdateToolStripMenuItem_Click);
|
||||
this.pauseDetectionToolStripMenuItem.Name = "pauseDetectionToolStripMenuItem";
|
||||
this.pauseDetectionToolStripMenuItem.Size = new System.Drawing.Size(160, 22);
|
||||
this.pauseDetectionToolStripMenuItem.Text = "暂停检测";
|
||||
this.pauseDetectionToolStripMenuItem.Click += new System.EventHandler(this.PauseDetectionToolStripMenuItem_Click);
|
||||
this.colorModeToolStripMenuItem.Name = "colorModeToolStripMenuItem";
|
||||
this.colorModeToolStripMenuItem.Size = new System.Drawing.Size(160, 22);
|
||||
this.colorModeToolStripMenuItem.Text = "色彩模式";
|
||||
@@ -188,17 +174,12 @@ namespace JoyD.Windows.CS.Toprie
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
// 先添加imageBox基础层
|
||||
// 添加imageBox
|
||||
this.Controls.Add(this.imageBox);
|
||||
// 再添加maskImageBox遮罩层,确保它显示在上面
|
||||
this.Controls.Add(this.maskImageBox);
|
||||
// 确保maskImageBox显示在顶层
|
||||
this.maskImageBox.BringToFront();
|
||||
this.Name = "Camera";
|
||||
this.Size = new System.Drawing.Size(512, 384);
|
||||
this.Load += new System.EventHandler(this.Camera_Load);
|
||||
((System.ComponentModel.ISupportInitialize)(this.imageBox)).EndInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.maskImageBox)).EndInit();
|
||||
this.contextMenuStrip1.ResumeLayout(false);
|
||||
this.ResumeLayout(false);
|
||||
|
||||
@@ -207,9 +188,8 @@ namespace JoyD.Windows.CS.Toprie
|
||||
#endregion
|
||||
|
||||
private System.Windows.Forms.PictureBox imageBox;
|
||||
private System.Windows.Forms.PictureBox maskImageBox;
|
||||
private System.Windows.Forms.ContextMenuStrip contextMenuStrip1;
|
||||
private System.Windows.Forms.ToolStripMenuItem pauseImageUpdateToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem pauseDetectionToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripSeparator toolStripSeparator1;
|
||||
private System.Windows.Forms.ToolStripMenuItem colorModeToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem whiteHotToolStripMenuItem;
|
||||
|
||||
@@ -187,10 +187,10 @@ namespace JoyD.Windows.CS.Toprie
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 暂停/恢复图像更新菜单项点击事件处理
|
||||
/// 暂停/恢复检测菜单项点击事件处理
|
||||
/// 1、暂停或恢复时,设置暂停状态,调用更新Info
|
||||
/// </summary>
|
||||
private void PauseImageUpdateToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
private void PauseDetectionToolStripMenuItem_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (DesignMode) return;
|
||||
|
||||
@@ -202,7 +202,7 @@ namespace JoyD.Windows.CS.Toprie
|
||||
if (_isPaused)
|
||||
{
|
||||
// 设置暂停状态
|
||||
pauseImageUpdateToolStripMenuItem.Text = "恢复图像更新";
|
||||
pauseDetectionToolStripMenuItem.Text = "恢复检测";
|
||||
|
||||
// 暂停时停止图像接收
|
||||
if (_isReceivingImage && _deviceManager != null)
|
||||
@@ -211,12 +211,12 @@ namespace JoyD.Windows.CS.Toprie
|
||||
_isReceivingImage = false;
|
||||
}
|
||||
|
||||
Console.WriteLine("图像更新已暂停");
|
||||
Console.WriteLine("检测已暂停");
|
||||
}
|
||||
else
|
||||
{
|
||||
// 设置恢复状态
|
||||
pauseImageUpdateToolStripMenuItem.Text = "暂停图像更新";
|
||||
pauseDetectionToolStripMenuItem.Text = "暂停检测";
|
||||
|
||||
// 恢复时,立即停止并重新开始图像接收,确保获取最新图像
|
||||
if (_deviceManager != null && _deviceManager.ConnectionStatus == ConnectionStatus.Connected)
|
||||
@@ -226,7 +226,7 @@ namespace JoyD.Windows.CS.Toprie
|
||||
_isReceivingImage = true;
|
||||
}
|
||||
|
||||
Console.WriteLine("图像更新已恢复");
|
||||
Console.WriteLine("检测已恢复");
|
||||
}
|
||||
|
||||
// 按照用户要求:暂停或恢复时,设置暂停状态,调用更新Info
|
||||
@@ -234,7 +234,7 @@ namespace JoyD.Windows.CS.Toprie
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"处理暂停/恢复图像更新时出错: {ex.Message}");
|
||||
Console.WriteLine($"处理暂停/恢复检测时出错: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1120,7 +1120,7 @@ namespace JoyD.Windows.CS.Toprie
|
||||
try
|
||||
{
|
||||
// 检查是否处于暂停状态
|
||||
bool isPaused = pauseImageUpdateToolStripMenuItem.Text == "恢复图像更新";
|
||||
bool isPaused = pauseDetectionToolStripMenuItem.Text == "恢复检测";
|
||||
|
||||
// 在暂停状态下,隐藏图像模式根菜单和色彩模式菜单
|
||||
// 注意:根菜单隐藏后,其所有子菜单会自动隐藏,不需要单独设置
|
||||
|
||||
Reference in New Issue
Block a user