在工具栏增加绘制温差图按钮(btnDrawTempDiff)
This commit is contained in:
@@ -28,6 +28,7 @@ namespace JoyD.Windows.CS
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.btnDrawTempDiff = new System.Windows.Forms.ToolStripButton();
|
||||
this.splitContainer = new System.Windows.Forms.SplitContainer();
|
||||
this.groupBoxTempDisplay = new System.Windows.Forms.GroupBox();
|
||||
this.picBoxTemp = new System.Windows.Forms.PictureBox();
|
||||
@@ -110,7 +111,8 @@ namespace JoyD.Windows.CS
|
||||
this.toolStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
this.btnDrawRegion,
|
||||
this.btnSelectColor,
|
||||
this.btnDeleteRegion});
|
||||
this.btnDeleteRegion,
|
||||
this.btnDrawTempDiff});
|
||||
this.toolStrip.LayoutStyle = System.Windows.Forms.ToolStripLayoutStyle.Flow;
|
||||
this.toolStrip.Location = new System.Drawing.Point(0, 0);
|
||||
this.toolStrip.Name = "toolStrip";
|
||||
@@ -147,6 +149,16 @@ namespace JoyD.Windows.CS
|
||||
this.btnDeleteRegion.ToolTipText = "删除选中的区域";
|
||||
this.btnDeleteRegion.Click += new System.EventHandler(this.BtnDeleteRegion_Click);
|
||||
//
|
||||
// btnDrawTempDiff
|
||||
//
|
||||
this.btnDrawTempDiff.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Image;
|
||||
this.btnDrawTempDiff.ImageTransparentColor = System.Drawing.Color.Transparent;
|
||||
this.btnDrawTempDiff.Name = "btnDrawTempDiff";
|
||||
this.btnDrawTempDiff.Size = new System.Drawing.Size(23, 4);
|
||||
this.btnDrawTempDiff.Text = "绘制温差图";
|
||||
this.btnDrawTempDiff.ToolTipText = "绘制温差对比图";
|
||||
this.btnDrawTempDiff.Click += new System.EventHandler(this.BtnDrawTempDiff_Click);
|
||||
//
|
||||
// btnDrawRegion
|
||||
//
|
||||
this.btnDrawRegion.Click += new System.EventHandler(this.BtnDrawRegion_Click);
|
||||
@@ -200,5 +212,6 @@ namespace JoyD.Windows.CS
|
||||
private System.Windows.Forms.ToolStripButton btnDrawRegion;
|
||||
private System.Windows.Forms.ToolStripButton btnSelectColor;
|
||||
private System.Windows.Forms.ToolStripButton btnDeleteRegion;
|
||||
private System.Windows.Forms.ToolStripButton btnDrawTempDiff;
|
||||
}
|
||||
}
|
||||
@@ -135,6 +135,15 @@ namespace JoyD.Windows.CS
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绘制温差图按钮点击事件
|
||||
/// </summary>
|
||||
private void BtnDrawTempDiff_Click(object sender, EventArgs e)
|
||||
{
|
||||
// 温差图绘制功能实现
|
||||
// TODO: 实现温差图绘制逻辑
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 绘制区域按钮点击事件
|
||||
/// </summary>
|
||||
@@ -705,6 +714,41 @@ namespace JoyD.Windows.CS
|
||||
|
||||
// 设置颜色选择按钮的图标
|
||||
UpdateColorButtonIcon();
|
||||
|
||||
// 设置绘制温差图按钮的图标
|
||||
try
|
||||
{
|
||||
Bitmap tempDiffIcon = new Bitmap(24, 24);
|
||||
using (Graphics g = Graphics.FromImage(tempDiffIcon))
|
||||
{
|
||||
// 设置高质量绘图
|
||||
g.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
|
||||
// 清除背景为透明
|
||||
g.Clear(Color.Transparent);
|
||||
|
||||
// 绘制表示温差的图标 - 使用渐变效果
|
||||
// 绘制底部蓝色(低温)和顶部红色(高温)的矩形条
|
||||
using (LinearGradientBrush gradientBrush = new LinearGradientBrush(
|
||||
new Rectangle(8, 5, 8, 14),
|
||||
Color.Blue, // 低温端
|
||||
Color.Red, // 高温端
|
||||
LinearGradientMode.Vertical))
|
||||
{
|
||||
g.FillRectangle(gradientBrush, 8, 5, 8, 14);
|
||||
}
|
||||
|
||||
// 添加边框
|
||||
g.DrawRectangle(new Pen(Color.Black, 1), 8, 5, 8, 14);
|
||||
}
|
||||
|
||||
btnDrawTempDiff.Image = tempDiffIcon;
|
||||
btnDrawTempDiff.ImageTransparentColor = Color.Transparent;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine("温差图按钮图标设置失败: " + ex.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user