diff --git a/Windows/CS/Framework4.0/Toprie/Toprie/Setting.Designer.cs b/Windows/CS/Framework4.0/Toprie/Toprie/Setting.Designer.cs index d6a6c8d..f764d6b 100644 --- a/Windows/CS/Framework4.0/Toprie/Toprie/Setting.Designer.cs +++ b/Windows/CS/Framework4.0/Toprie/Toprie/Setting.Designer.cs @@ -32,12 +32,12 @@ namespace JoyD.Windows.CS this.groupBoxTempDisplay = new System.Windows.Forms.GroupBox(); this.picBoxTemp = new System.Windows.Forms.PictureBox(); this.toolStripContainer = new System.Windows.Forms.ToolStripContainer(); - this.tempDiffToolStrip = new System.Windows.Forms.ToolStrip(); this.toolStrip = new System.Windows.Forms.ToolStrip(); this.btnDrawRegion = new System.Windows.Forms.ToolStripButton(); this.btnSelectColor = new System.Windows.Forms.ToolStripButton(); this.btnDeleteRegion = new System.Windows.Forms.ToolStripButton(); this.btnDrawTempDiff = new System.Windows.Forms.ToolStripButton(); + this.tempDiffToolStrip = new System.Windows.Forms.ToolStrip(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit(); this.splitContainer.Panel1.SuspendLayout(); this.splitContainer.Panel2.SuspendLayout(); @@ -93,13 +93,25 @@ namespace JoyD.Windows.CS this.picBoxTemp.MouseMove += new System.Windows.Forms.MouseEventHandler(this.PicBoxTemp_MouseMove); this.picBoxTemp.MouseUp += new System.Windows.Forms.MouseEventHandler(this.PicBoxTemp_MouseUp); // + // dataGridViewTempDiff + // + this.dataGridViewTempDiff.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; + this.dataGridViewTempDiff.Dock = System.Windows.Forms.DockStyle.Fill; + this.dataGridViewTempDiff.Location = new System.Drawing.Point(0, 0); + this.dataGridViewTempDiff.Name = "dataGridViewTempDiff"; + this.dataGridViewTempDiff.RowHeadersWidth = 51; + this.dataGridViewTempDiff.RowTemplate.Height = 27; + this.dataGridViewTempDiff.Size = new System.Drawing.Size(174, 400); + this.dataGridViewTempDiff.TabIndex = 0; + // // toolStripContainer // // // toolStripContainer.ContentPanel // this.toolStripContainer.ContentPanel.AutoScroll = true; - this.toolStripContainer.ContentPanel.Size = new System.Drawing.Size(174, 425); + this.toolStripContainer.ContentPanel.Controls.Add(this.dataGridViewTempDiff); + this.toolStripContainer.ContentPanel.Size = new System.Drawing.Size(174, 400); this.toolStripContainer.Dock = System.Windows.Forms.DockStyle.Fill; this.toolStripContainer.Location = new System.Drawing.Point(0, 0); this.toolStripContainer.Name = "toolStripContainer"; @@ -112,17 +124,6 @@ namespace JoyD.Windows.CS this.toolStripContainer.TopToolStripPanel.Controls.Add(this.toolStrip); this.toolStripContainer.TopToolStripPanel.Controls.Add(this.tempDiffToolStrip); // - // tempDiffToolStrip - // - this.tempDiffToolStrip.AllowDrop = true; - this.tempDiffToolStrip.Dock = System.Windows.Forms.DockStyle.None; - this.tempDiffToolStrip.ImageScalingSize = new System.Drawing.Size(20, 20); - this.tempDiffToolStrip.Location = new System.Drawing.Point(110, 0); - this.tempDiffToolStrip.Name = "tempDiffToolStrip"; - this.tempDiffToolStrip.Size = new System.Drawing.Size(51, 25); - this.tempDiffToolStrip.TabIndex = 4; - this.tempDiffToolStrip.Text = "温差图例"; - // // toolStrip // this.toolStrip.AllowDrop = true; @@ -180,6 +181,17 @@ namespace JoyD.Windows.CS this.btnDrawTempDiff.ToolTipText = "绘制温差图"; this.btnDrawTempDiff.Click += new System.EventHandler(this.BtnDrawTempDiff_Click); // + // tempDiffToolStrip + // + this.tempDiffToolStrip.AllowDrop = true; + this.tempDiffToolStrip.Dock = System.Windows.Forms.DockStyle.None; + this.tempDiffToolStrip.ImageScalingSize = new System.Drawing.Size(20, 20); + this.tempDiffToolStrip.Location = new System.Drawing.Point(4, 25); + this.tempDiffToolStrip.Name = "tempDiffToolStrip"; + this.tempDiffToolStrip.Size = new System.Drawing.Size(111, 25); + this.tempDiffToolStrip.TabIndex = 4; + this.tempDiffToolStrip.Text = "温差图例"; + // // Setting // this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F); @@ -219,5 +231,6 @@ namespace JoyD.Windows.CS private System.Windows.Forms.ToolStripButton btnSelectColor; private System.Windows.Forms.ToolStripButton btnDeleteRegion; private System.Windows.Forms.ToolStripButton btnDrawTempDiff; + private System.Windows.Forms.DataGridView dataGridViewTempDiff; } } \ No newline at end of file diff --git a/Windows/CS/Framework4.0/Toprie/Toprie/Setting.cs b/Windows/CS/Framework4.0/Toprie/Toprie/Setting.cs index 04abb21..59e8105 100644 --- a/Windows/CS/Framework4.0/Toprie/Toprie/Setting.cs +++ b/Windows/CS/Framework4.0/Toprie/Toprie/Setting.cs @@ -74,11 +74,70 @@ namespace JoyD.Windows.CS { Console.WriteLine("删除按钮初始化失败: " + ex.Message); } + + // 初始化温差图例DataGridView + InitializeTempDiffDataGridView(); } /// /// 鼠标按下事件 - 处理右击退出绘制状态、左击开始绘制矩形和开始调整区域大小 /// + private void InitializeTempDiffDataGridView() + { + // 添加列:温差值 + DataGridViewTextBoxColumn columnTempDiff = new DataGridViewTextBoxColumn(); + columnTempDiff.Name = "tempDiffValue"; + columnTempDiff.HeaderText = "温差值"; + columnTempDiff.Width = 80; + columnTempDiff.ReadOnly = false; + + // 添加列:颜色 + DataGridViewButtonColumn columnColor = new DataGridViewButtonColumn(); + columnColor.Name = "colorColumn"; + columnColor.HeaderText = "颜色"; + columnColor.Width = 80; + columnColor.Text = "选择"; + columnColor.UseColumnTextForButtonValue = true; + + // 添加列到DataGridView + dataGridViewTempDiff.Columns.Clear(); + dataGridViewTempDiff.Columns.Add(columnTempDiff); + dataGridViewTempDiff.Columns.Add(columnColor); + + // 添加按钮点击事件 + dataGridViewTempDiff.CellContentClick += new DataGridViewCellEventHandler(DataGridViewTempDiff_CellContentClick); + + // 添加一些示例数据 + AddSampleTempDiffData(); + } + + private void AddSampleTempDiffData() + { + // 添加示例行 + dataGridViewTempDiff.Rows.Add("10°C", "选择"); + dataGridViewTempDiff.Rows.Add("20°C", "选择"); + dataGridViewTempDiff.Rows.Add("30°C", "选择"); + } + + private void DataGridViewTempDiff_CellContentClick(object sender, DataGridViewCellEventArgs e) + { + if (e.RowIndex >= 0) + { + // 处理颜色选择按钮点击 + if (e.ColumnIndex == dataGridViewTempDiff.Columns["colorColumn"].Index) + { + using (ColorDialog colorDialog = new ColorDialog()) + { + if (colorDialog.ShowDialog() == DialogResult.OK) + { + // 这里可以保存选择的颜色 + Console.WriteLine("选择的颜色: " + colorDialog.Color.Name); + } + } + } + } + } + private void PicBoxTemp_MouseDown(object sender, MouseEventArgs e) { // 检查是否处于温差图绘制状态且右击鼠标