From bc27de2ea54c8026e8616410a9413304f6f139d6 Mon Sep 17 00:00:00 2001 From: mjjo53 Date: Fri, 23 Jun 2017 14:59:08 +0900 Subject: [PATCH] =?UTF-8?q?-=20Material=20Pair=EC=97=90=20layout=20?= =?UTF-8?q?=EC=A0=81=EC=9A=A9=20-=20Trend=20Graph=EC=97=90=20Force,=20Velo?= =?UTF-8?q?city=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DataHandler.cs | 7 +- MainForm.Designer.cs | 23 +- MainForm.cs | 32 ++- MainForm.resx | 20 +- PanelAnalysis.Designer.cs | 16 +- PanelAnalysis.cs | 10 +- PanelMaterial.Designer.cs | 57 +++-- PanelRadarGraph.cs | 9 +- PanelResult.cs | 47 ++++- PanelTrendGraph.Designer.cs | 34 ++- PanelTrendGraph.cs | 411 ++++++++++++++++++++++++------------ Theme.cs | 10 +- 12 files changed, 488 insertions(+), 188 deletions(-) diff --git a/DataHandler.cs b/DataHandler.cs index dc35484..0052e72 100644 --- a/DataHandler.cs +++ b/DataHandler.cs @@ -40,6 +40,8 @@ namespace friction { public float HUMIDITY; public float TEMPERATURE; + public float FORCE; + public float VELOCITY; public float RPN; override public string ToString() @@ -207,7 +209,7 @@ namespace friction return result; } - public List GetHumidityChart(string strSpring, string strTable) + public List GetTrendChart(string strSpring, string strTable) { string strQuery = string.Format("[{0}]='{1}' and [{2}]='{3}'", Config.COLUMN_NAME.SPRING, strSpring, Config.COLUMN_NAME.TABLE, strTable); DataRow[] rows = m_Data.Select(strQuery); @@ -219,6 +221,8 @@ namespace friction { HUMIDITY = (float)r[Config.COLUMN_NAME.HUMIDITY], TEMPERATURE = (float)r[Config.COLUMN_NAME.TEMP], + FORCE = (float)r[Config.COLUMN_NAME.FORCE], + VELOCITY = (float)r[Config.COLUMN_NAME.VELOCITY], RPN = (float)r[Config.COLUMN_NAME.RPN], }); } @@ -226,7 +230,6 @@ namespace friction return result; } - #region calculation float CalcDependency(DataRow[] rows, string strColumn) { diff --git a/MainForm.Designer.cs b/MainForm.Designer.cs index 0895594..016a301 100644 --- a/MainForm.Designer.cs +++ b/MainForm.Designer.cs @@ -55,6 +55,8 @@ this.reportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.allToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.dockPanel = new WeifenLuo.WinFormsUI.Docking.DockPanel(); + this.aToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripMain.SuspendLayout(); this.statusStrip.SuspendLayout(); this.menuStrip.SuspendLayout(); @@ -184,7 +186,8 @@ this.fileToolStripMenuItem, this.tableToolStripMenuItem, this.graphToolStripMenuItem, - this.reportToolStripMenuItem}); + this.reportToolStripMenuItem, + this.aToolStripMenuItem}); this.menuStrip.Location = new System.Drawing.Point(0, 0); this.menuStrip.Name = "menuStrip"; this.menuStrip.Size = new System.Drawing.Size(1184, 24); @@ -291,6 +294,21 @@ this.dockPanel.Size = new System.Drawing.Size(1184, 690); this.dockPanel.TabIndex = 2; // + // aToolStripMenuItem + // + this.aToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.aboutToolStripMenuItem}); + this.aToolStripMenuItem.Name = "aToolStripMenuItem"; + this.aToolStripMenuItem.Size = new System.Drawing.Size(44, 20); + this.aToolStripMenuItem.Text = "Help"; + // + // aboutToolStripMenuItem + // + this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem"; + this.aboutToolStripMenuItem.Size = new System.Drawing.Size(152, 22); + this.aboutToolStripMenuItem.Text = "About"; + this.aboutToolStripMenuItem.Click += new System.EventHandler(this.aboutToolStripMenuItem_Click); + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); @@ -302,6 +320,7 @@ this.Controls.Add(this.menuStrip); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MainMenuStrip = this.menuStrip; + this.MinimumSize = new System.Drawing.Size(800, 600); this.Name = "MainForm"; this.Text = "Material Stick-Slip Analysis"; this.toolStripMain.ResumeLayout(false); @@ -343,6 +362,8 @@ private System.Windows.Forms.ToolStripMenuItem allToolStripMenuItem; private System.Windows.Forms.ToolStripButton toolStripButtonMaterial; private System.Windows.Forms.ToolStripSeparator toolStripSeparator3; + private System.Windows.Forms.ToolStripMenuItem aToolStripMenuItem; + private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem; } } diff --git a/MainForm.cs b/MainForm.cs index 88264f0..fd1a0fe 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -70,6 +70,8 @@ namespace friction DialogResult result = ofd.ShowDialog(); if (result == DialogResult.OK) m_DBFileName = ofd.FileName; + else + return; } else { @@ -98,7 +100,7 @@ namespace friction UpdateRecentFile(); } - private void OpenPanel(DockContent panel) + public void OpenPanel(DockContent panel) { if (panel.Visible == false) panel.Show(dockPanel); @@ -146,8 +148,16 @@ namespace friction OpenPanel(m_TrendGraphPanel); m_TrendGraphPanel.UpdateGraph(); } + + private void aboutToolStripMenuItem_Click(object sender, EventArgs e) + { + //AboutWindow aboutWindow = new AboutWindow(); + //aboutWindow.Show(); + } #endregion + + #region Events from toolbox private void toolStripButtonOpen_Click(object sender, EventArgs e) { @@ -185,8 +195,6 @@ namespace friction #region Events from panels public void OnApplyData(string strSpring, string strTable) { - Console.WriteLine(string.Format("[start] MainForm::OnApplyData({0}, {1})", strSpring, strTable)); - m_DataHandler.SetSelectedMaterial(strSpring, strTable); if (strTable == "All") @@ -209,28 +217,42 @@ namespace friction } m_AnalysisPanel.UpdateData(m_DataHandler); - - Console.WriteLine(string.Format("[end ] MainForm::OnApplyData({0}, {1})", strSpring, strTable)); } public void OnRadarSelectTable(string strTable) { if (m_AnalysisPanel != null) m_AnalysisPanel.SelectRow(strTable); + OpenPanel(m_AnalysisPanel); } public void OnTrendSelectByHumidity(string strSpring, string strTable, float fHumidity, float fRPN) { if (m_ResultPanel != null) m_ResultPanel.SelectRowByHumidity(strSpring, strTable, fHumidity, fRPN); + OpenPanel(m_ResultPanel); } public void OnTrendSelectByTemperature(string strSpring, string strTable, float fTemperature, float fRPN) { if (m_ResultPanel != null) m_ResultPanel.SelectRowByTemperature(strSpring, strTable, fTemperature, fRPN); + OpenPanel(m_ResultPanel); } + public void OnTrendSelectByForce(string strSpring, string strTable, float fTemperature, float fRPN) + { + if (m_ResultPanel != null) + m_ResultPanel.SelectRowByForce(strSpring, strTable, fTemperature, fRPN); + OpenPanel(m_ResultPanel); + } + + public void OnTrendSelectByVelocity(string strSpring, string strTable, float fTemperature, float fRPN) + { + if (m_ResultPanel != null) + m_ResultPanel.SelectRowByVelocity(strSpring, strTable, fTemperature, fRPN); + OpenPanel(m_ResultPanel); + } #endregion } } diff --git a/MainForm.resx b/MainForm.resx index e672d22..84f9232 100644 --- a/MainForm.resx +++ b/MainForm.resx @@ -166,24 +166,24 @@ iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 - YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFdSURBVDhPYxh8wGfmJi6fSbtLfSfuPu8xcffPyP27/hcd - PPw1a/uRTZlbDgtClWEHXlP2yvv2774O1PwfhlOOHvhfdeE0GBcfO/EjZeN+C6hyVACyGV0zCOedOgo3 - AGZI6O4z/FBtCOA7YU8Zumbvvp1X848d/45sAAhn7Dy2AaoNAYC2X0AxYNLOBKgUQ/qOw7ORDSg6cPgr - VAoBQAGGbDNUGA5ATocZUHnu1H+oMAIgG+A1cdcVqDAE/P/PuObBmx+7X33+v/XFp/+rn77HNMC7f8c5 + YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAFdSURBVDhPYxh8wGfmJi6fSbtLfSfuPu8+cffPyP27/hcd + OPQ1a/uRTZlbDgtClWEHXlP2yvv2774O1PwfhlOOHvhfdeE0GBcfO/EjZeN+C6hyVACyGV0zCOedOgo3 + AGZI6O4z/FBtCOA7YU8Zumbvvp1X848d/45sAAhn7Dy2AaoNAYC2X0AxYNLOBKgUQ/qOw7ORDSjaf+gr + VAoBQAGGbDNUGA5ATocZUHnu1H+oMAIgG+A1cdcVqDAE/P/PuPrBmx+7X33+v/XFp/+rn77HNMC7f8c5 mAEg7DNhVyJUiqF80/m2w2+//ofhtXdefYFKIYDPxN1FyAZA8TUwnrD7f/nmi3ADpp1+sBaqDQFCeo9x - gpyOZgAce0/Y9T99+cn/62++/l5/4hYfVBsq8JmwWw6fIW69O24mzdlvAlWOHdjP388B8c6us779276D - 8cTdZ4D8ApAcVNmgAQwMANmePnUCkMyWAAAAAElFTkSuQmCC + gpyOZgAce0/Y9T99+cn/62+8/l5/4hYfVBsq8JmwWw6fIW69O24mzdlvAlWOHdjP388B8c6us779W7+D + 8cTdZ4D8ApAcVNmgAQwMAMJCPmrrgfeiAAAAAElFTkSuQmCC iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAEpSURBVDhPY6A7COk9xuk1Za88lIsdBE7bKeY7aac1lIsC - /CbtXunbs+2fV/8uTagQJvCdtHuT78Td//2n7DSACoHB8RefxTsP3rruM2Hnbv/+/QJQYUww6eitw3Hz - D23d8+LDgcNvPrvaz9/PceDtZ91Dr7+sKD17Vqrq/MlAqFJMcOjNl7pNj14EVJ47ZQ/iL732vNunb/uv + /CbtXunbvfWfV/8uTagQJvCdtHuT78Td//2n7DSACoHB8RefxTsP3rruM2Hnbv/+/QJQYUww6eitw3Hz + D23d8+LDgcNvPrvaz9/PceDtZ91Dr7+sKD17Vqrq/MlAqFJMcOjNl7pNj14EVJ47ZQ/iL732vNund9uv vDUnL4H45edO6FedPz0BxMYAB998DT785msOsiK/ybukAibte+IzcVc1iI/VALfeHULBk/ccb9595QCI - j66o8vyZgKrzx6RBbKwGgELUY+Luv74Tdi0B8TEMuHC6H+hvcIBiNQAE0nccds3YeVQMxCbLAHyKRooB - oBRWeOwYJ4hdf38/ByzaQACfHIWAgQEAKbL9ZOjCSnkAAAAASUVORK5CYII= + j66o8vyZgKrzx6RBbKwGgELUfeLuv74Tdi0B8TEMuHC6H+hvcIBiNQAE0nccds3YeVQMxCbLAHyKRooB + oBRWeOwYJ4hdf38/ByzaQACfHIWAgQEAG7v9X5RifekAAAAASUVORK5CYII= diff --git a/PanelAnalysis.Designer.cs b/PanelAnalysis.Designer.cs index 747795c..d31ed02 100644 --- a/PanelAnalysis.Designer.cs +++ b/PanelAnalysis.Designer.cs @@ -39,6 +39,7 @@ this.lbInfo22 = new System.Windows.Forms.Label(); this.lbInfo23 = new System.Windows.Forms.Label(); this.lbInfo24 = new System.Windows.Forms.Label(); + this.lbSpring = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.dgvAnalysis)).BeginInit(); this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); @@ -52,11 +53,11 @@ | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.dgvAnalysis.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.dgvAnalysis.Location = new System.Drawing.Point(12, 12); + this.dgvAnalysis.Location = new System.Drawing.Point(12, 33); this.dgvAnalysis.Name = "dgvAnalysis"; this.dgvAnalysis.ReadOnly = true; this.dgvAnalysis.RowTemplate.Height = 23; - this.dgvAnalysis.Size = new System.Drawing.Size(856, 567); + this.dgvAnalysis.Size = new System.Drawing.Size(856, 546); this.dgvAnalysis.TabIndex = 0; // // tableLayoutPanel1 @@ -195,12 +196,21 @@ this.lbInfo24.TabIndex = 2; this.lbInfo24.Text = "Not Enough Data"; // + // lbSpring + // + this.lbSpring.AutoSize = true; + this.lbSpring.Location = new System.Drawing.Point(12, 9); + this.lbSpring.Name = "lbSpring"; + this.lbSpring.Size = new System.Drawing.Size(0, 12); + this.lbSpring.TabIndex = 2; + // // PanelAnalysis // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.ClientSize = new System.Drawing.Size(880, 649); this.ControlBox = false; + this.Controls.Add(this.lbSpring); this.Controls.Add(this.tableLayoutPanel1); this.Controls.Add(this.dgvAnalysis); this.HideOnClose = true; @@ -212,6 +222,7 @@ this.tableLayoutPanel1.ResumeLayout(false); this.tableLayoutPanel1.PerformLayout(); this.ResumeLayout(false); + this.PerformLayout(); } @@ -228,5 +239,6 @@ private System.Windows.Forms.Label lbInfo22; private System.Windows.Forms.Label lbInfo23; private System.Windows.Forms.Label lbInfo24; + private System.Windows.Forms.Label lbSpring; } } \ No newline at end of file diff --git a/PanelAnalysis.cs b/PanelAnalysis.cs index d7d2ac6..4c9e4c2 100644 --- a/PanelAnalysis.cs +++ b/PanelAnalysis.cs @@ -4,7 +4,6 @@ using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; -using System.Reflection; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; @@ -27,10 +26,6 @@ namespace friction Theme.Apply(this); Theme.Apply(dgvAnalysis); - typeof(DataGridView).InvokeMember("DoubleBuffered", - BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty, - null, dgvAnalysis, new object[] { true }); - lbInfo11.BackColor = Theme.Green; lbInfo12.BackColor = Theme.Yellow; lbInfo13.BackColor = Theme.Red; @@ -73,6 +68,9 @@ namespace friction if (strSpring == m_CurSpring) return; + lbSpring.Text = "Material Spring: " +strSpring; + lbSpring.ForeColor = Color.Orange; + dgvAnalysis.Columns.Clear(); dgvAnalysis.Rows.Clear(); @@ -90,6 +88,8 @@ namespace friction foreach (string strTable in data.GetTableList()) { DataHandler.CalcResult result = data.GetCalc(strSpring, strTable); + if (result.m_iCnt <= 0) + continue; int iIdx = dgvAnalysis.Rows.Add(strTable, result.m_iCnt, result.m_fAvgRPN, result.m_fStdRPN, result.m_fDiffByForce, result.m_fDiffByTemp, result.m_fDiffByHumid, result.m_fDiffByVel); diff --git a/PanelMaterial.Designer.cs b/PanelMaterial.Designer.cs index bea3616..41352d0 100644 --- a/PanelMaterial.Designer.cs +++ b/PanelMaterial.Designer.cs @@ -35,21 +35,24 @@ this.lvchSpring = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); this.lvTable = new System.Windows.Forms.ListView(); this.lvchTable = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader())); + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.tableLayoutPanel1.SuspendLayout(); this.SuspendLayout(); // // lbFileName // this.lbFileName.AutoSize = true; this.lbFileName.Font = new System.Drawing.Font("Malgun Gothic", 14.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(129))); - this.lbFileName.Location = new System.Drawing.Point(7, 9); + this.lbFileName.Location = new System.Drawing.Point(3, 0); this.lbFileName.Name = "lbFileName"; this.lbFileName.Size = new System.Drawing.Size(0, 25); this.lbFileName.TabIndex = 4; // // label2 // + this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(12, 46); + this.label2.Location = new System.Drawing.Point(3, 43); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(90, 12); this.label2.TabIndex = 5; @@ -59,7 +62,7 @@ // this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(10, 339); + this.label3.Location = new System.Drawing.Point(3, 389); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(86, 12); this.label3.TabIndex = 6; @@ -67,15 +70,14 @@ // // lvSpring // - this.lvSpring.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); this.lvSpring.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.lvchSpring}); + this.lvSpring.Dock = System.Windows.Forms.DockStyle.Fill; this.lvSpring.FullRowSelect = true; this.lvSpring.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; - this.lvSpring.Location = new System.Drawing.Point(12, 61); + this.lvSpring.Location = new System.Drawing.Point(3, 58); this.lvSpring.Name = "lvSpring"; - this.lvSpring.Size = new System.Drawing.Size(326, 263); + this.lvSpring.Size = new System.Drawing.Size(292, 320); this.lvSpring.TabIndex = 7; this.lvSpring.UseCompatibleStateImageBehavior = false; this.lvSpring.View = System.Windows.Forms.View.Details; @@ -89,16 +91,14 @@ // // lvTable // - this.lvTable.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); this.lvTable.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] { this.lvchTable}); + this.lvTable.Dock = System.Windows.Forms.DockStyle.Fill; this.lvTable.FullRowSelect = true; this.lvTable.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None; - this.lvTable.Location = new System.Drawing.Point(12, 354); + this.lvTable.Location = new System.Drawing.Point(3, 404); this.lvTable.Name = "lvTable"; - this.lvTable.Size = new System.Drawing.Size(326, 361); + this.lvTable.Size = new System.Drawing.Size(292, 320); this.lvTable.TabIndex = 8; this.lvTable.UseCompatibleStateImageBehavior = false; this.lvTable.View = System.Windows.Forms.View.Details; @@ -110,24 +110,42 @@ this.lvchTable.Text = "Table"; this.lvchTable.Width = 305; // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.ColumnCount = 1; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel1.Controls.Add(this.lbFileName, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.lvTable, 0, 4); + this.tableLayoutPanel1.Controls.Add(this.lvSpring, 0, 2); + this.tableLayoutPanel1.Controls.Add(this.label2, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.label3, 0, 3); + this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill; + this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 5; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 35F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); + this.tableLayoutPanel1.Size = new System.Drawing.Size(298, 727); + this.tableLayoutPanel1.TabIndex = 9; + // // PanelMaterial // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(350, 727); + this.ClientSize = new System.Drawing.Size(298, 727); this.ControlBox = false; - this.Controls.Add(this.lvTable); - this.Controls.Add(this.lvSpring); - this.Controls.Add(this.label3); - this.Controls.Add(this.label2); - this.Controls.Add(this.lbFileName); + this.Controls.Add(this.tableLayoutPanel1); this.HideOnClose = true; this.Name = "PanelMaterial"; this.ShowHint = WeifenLuo.WinFormsUI.Docking.DockState.DockLeft; this.TabText = "Material Pair"; this.Text = "Material Pair"; + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); this.ResumeLayout(false); - this.PerformLayout(); } @@ -139,5 +157,6 @@ private System.Windows.Forms.ListView lvTable; private System.Windows.Forms.ColumnHeader lvchSpring; private System.Windows.Forms.ColumnHeader lvchTable; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; } } \ No newline at end of file diff --git a/PanelRadarGraph.cs b/PanelRadarGraph.cs index af61814..c6ef64e 100644 --- a/PanelRadarGraph.cs +++ b/PanelRadarGraph.cs @@ -37,13 +37,14 @@ namespace friction chart.Series["SeriesAvg"].Color = Theme.Yellow; chart.Series["SeriesMin"].Color = Theme.Green; - chart.ChartAreas[0].AxisX.MajorGrid.LineWidth = 0; - chart.ChartAreas[0].AxisY.MajorGrid.LineWidth = 0; + chart.ChartAreas[0].AxisX.MajorGrid.LineWidth = 1; + chart.ChartAreas[0].AxisY.MajorGrid.LineWidth = 1; + chart.ChartAreas[0].AxisY.MajorGrid.LineColor = Color.Black; chart.ChartAreas[0].AxisX.MajorTickMark.Enabled = false; chart.ChartAreas[0].AxisX.MinorTickMark.Enabled = false; chart.ChartAreas[0].AxisY.MajorTickMark.Enabled = true; chart.ChartAreas[0].AxisY.MajorTickMark.LineWidth = 1; - chart.ChartAreas[0].AxisY.MajorTickMark.LineColor = Color.FromArgb(50, 0, 0, 0); + chart.ChartAreas[0].AxisY.MajorTickMark.LineColor = Color.FromArgb(150, 0, 0, 0); chart.ChartAreas[0].AxisY.MinorTickMark.Enabled = false; foreach (var series in chart.Series) @@ -78,8 +79,6 @@ namespace friction chart.Series["SeriesHigh"].Points.AddXY(data.m_strTable, (int)Config.ANALYSIS.RISK.HIGH); chart.Series["SeriesPotential"].Points.AddXY(data.m_strTable, (int)Config.ANALYSIS.RISK.POTENTIAL); chart.Series["SeriesNo"].Points.AddXY(data.m_strTable, (int)Config.ANALYSIS.RISK.NO); - - //break; } diff --git a/PanelResult.cs b/PanelResult.cs index 4872e33..1b2e8cd 100644 --- a/PanelResult.cs +++ b/PanelResult.cs @@ -4,7 +4,6 @@ using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; -using System.Reflection; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; @@ -26,9 +25,6 @@ namespace friction Theme.Apply(dgvData); Theme.Apply(lvColumn); - typeof(DataGridView).InvokeMember("DoubleBuffered", - BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty, - null, dgvData, new object[] { true }); dgvData.CellFormatting += DgvData_CellFormatting; } @@ -135,7 +131,48 @@ namespace friction row.Selected = true; dgvData.FirstDisplayedScrollingRowIndex = row.Index; } - + } + + public void SelectRowByForce(string strSpring, string strTable, float fForce, float fRPN) + { + dgvData.ClearSelection(); + + DataGridViewRow row = dgvData.Rows + .Cast() + .Where(r => + r.Cells[Config.COLUMN_NAME.SPRING].Value.Equals(strSpring) && + r.Cells[Config.COLUMN_NAME.TABLE].Value.Equals(strTable) && + r.Cells[Config.COLUMN_NAME.RPN].Value.Equals(fRPN) && + r.Cells[Config.COLUMN_NAME.FORCE].Value.Equals(fForce) + ) + .First(); + + if (row != null) + { + row.Selected = true; + dgvData.FirstDisplayedScrollingRowIndex = row.Index; + } + } + + public void SelectRowByVelocity(string strSpring, string strTable, float fVelocity, float fRPN) + { + dgvData.ClearSelection(); + + DataGridViewRow row = dgvData.Rows + .Cast() + .Where(r => + r.Cells[Config.COLUMN_NAME.SPRING].Value.Equals(strSpring) && + r.Cells[Config.COLUMN_NAME.TABLE].Value.Equals(strTable) && + r.Cells[Config.COLUMN_NAME.RPN].Value.Equals(fRPN) && + r.Cells[Config.COLUMN_NAME.VELOCITY].Value.Equals(fVelocity) + ) + .First(); + + if (row != null) + { + row.Selected = true; + dgvData.FirstDisplayedScrollingRowIndex = row.Index; + } } } } diff --git a/PanelTrendGraph.Designer.cs b/PanelTrendGraph.Designer.cs index 36471e7..2ae499b 100644 --- a/PanelTrendGraph.Designer.cs +++ b/PanelTrendGraph.Designer.cs @@ -32,6 +32,8 @@ this.rbHumidity = new System.Windows.Forms.RadioButton(); this.rbTemp = new System.Windows.Forms.RadioButton(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.rbForce = new System.Windows.Forms.RadioButton(); + this.rbVelocity = new System.Windows.Forms.RadioButton(); this.groupBox1.SuspendLayout(); this.SuspendLayout(); // @@ -77,15 +79,43 @@ // groupBox1 // this.groupBox1.Controls.Add(this.rbHumidity); + this.groupBox1.Controls.Add(this.rbVelocity); + this.groupBox1.Controls.Add(this.rbForce); this.groupBox1.Controls.Add(this.rbTemp); this.groupBox1.ForeColor = System.Drawing.SystemColors.ControlText; this.groupBox1.Location = new System.Drawing.Point(8, 3); this.groupBox1.Name = "groupBox1"; - this.groupBox1.Size = new System.Drawing.Size(171, 50); + this.groupBox1.Size = new System.Drawing.Size(297, 50); this.groupBox1.TabIndex = 2; this.groupBox1.TabStop = false; this.groupBox1.Text = "Data"; // + // rbForce + // + this.rbForce.Appearance = System.Windows.Forms.Appearance.Button; + this.rbForce.AutoSize = true; + this.rbForce.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.rbForce.Location = new System.Drawing.Point(171, 20); + this.rbForce.Name = "rbForce"; + this.rbForce.Size = new System.Drawing.Size(49, 24); + this.rbForce.TabIndex = 1; + this.rbForce.Text = "Force"; + this.rbForce.UseVisualStyleBackColor = true; + this.rbForce.CheckedChanged += new System.EventHandler(this.rbForce_CheckedChanged); + // + // rbVelocity + // + this.rbVelocity.Appearance = System.Windows.Forms.Appearance.Button; + this.rbVelocity.AutoSize = true; + this.rbVelocity.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.rbVelocity.Location = new System.Drawing.Point(226, 19); + this.rbVelocity.Name = "rbVelocity"; + this.rbVelocity.Size = new System.Drawing.Size(62, 24); + this.rbVelocity.TabIndex = 1; + this.rbVelocity.Text = "Velocity"; + this.rbVelocity.UseVisualStyleBackColor = true; + this.rbVelocity.CheckedChanged += new System.EventHandler(this.rbVelocity_CheckedChanged); + // // PanelTrendGraph // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 12F); @@ -111,5 +141,7 @@ private System.Windows.Forms.RadioButton rbHumidity; private System.Windows.Forms.RadioButton rbTemp; private System.Windows.Forms.GroupBox groupBox1; + private System.Windows.Forms.RadioButton rbVelocity; + private System.Windows.Forms.RadioButton rbForce; } } \ No newline at end of file diff --git a/PanelTrendGraph.cs b/PanelTrendGraph.cs index 413d08f..7f70c7f 100644 --- a/PanelTrendGraph.cs +++ b/PanelTrendGraph.cs @@ -18,12 +18,22 @@ namespace friction { public partial class PanelTrendGraph : DockContent { + public enum GRAPH_TYPE + { + NONE, + HUMIDITY, + TEMPERATURE, + FORCE, + VELOCITY + } + + MainForm m_Owner = null; DataHandler m_DataHandler = null; string m_CurSpring = ""; string m_CurTable = ""; - bool m_bHumidity = false; + GRAPH_TYPE m_GraphType = GRAPH_TYPE.NONE; public PanelTrendGraph(MainForm owner, DataHandler data) { @@ -65,7 +75,6 @@ namespace friction }, new AxisSection { - //Label = "Good", Value = 3, SectionWidth = 2, Fill = new SolidColorBrush @@ -76,7 +85,6 @@ namespace friction }, new AxisSection { - //Label = "Bad", Value = 0, SectionWidth = 3, Fill = new SolidColorBrush @@ -100,111 +108,97 @@ namespace friction { m_CurSpring = ""; m_CurTable = ""; - m_bHumidity = false; + m_GraphType = GRAPH_TYPE.NONE; } private void TrendChart_DataClick(object sender, ChartPoint chartPoint) { - if (m_bHumidity == true) - m_Owner.OnTrendSelectByHumidity(m_CurSpring, m_CurTable, (float)chartPoint.X, (float)chartPoint.Y); - else - m_Owner.OnTrendSelectByTemperature(m_CurSpring, m_CurTable, (float)chartPoint.X, (float)chartPoint.Y); + switch (m_GraphType) + { + case GRAPH_TYPE.HUMIDITY: + m_Owner.OnTrendSelectByHumidity(m_CurSpring, m_CurTable, (float)chartPoint.X, (float)chartPoint.Y); + break; + + case GRAPH_TYPE.TEMPERATURE: + m_Owner.OnTrendSelectByTemperature(m_CurSpring, m_CurTable, (float)chartPoint.X, (float)chartPoint.Y); + break; + + case GRAPH_TYPE.FORCE: + m_Owner.OnTrendSelectByForce(m_CurSpring, m_CurTable, (float)chartPoint.X, (float)chartPoint.Y); + break; + + case GRAPH_TYPE.VELOCITY: + m_Owner.OnTrendSelectByVelocity(m_CurSpring, m_CurTable, (float)chartPoint.X, (float)chartPoint.Y); + break; + } } - public void UpdateGraph() + private void UpdateGraphHumidity() { string strSpring = m_DataHandler.GetCurSpring(); string strTable = m_DataHandler.GetCurTable(); - Console.WriteLine(string.Format("[start] TrendGraph::UpdateGraph ({0}, {1}) -> ({2}, {3})", - m_CurSpring, m_CurTable, strSpring, strTable)); - - if (m_CurSpring == strSpring && m_CurTable == strTable - && rbHumidity.Checked == m_bHumidity - && m_bHumidity == rbHumidity.Checked) - { - return; - } - - - var Chart = m_DataHandler.GetHumidityChart(strSpring, strTable); + var Chart = m_DataHandler.GetTrendChart(strSpring, strTable); if (Chart.Count <= 0) - { - foreach(Series series in trendChart.Series) - series.Values.Clear(); - - m_CurSpring = strSpring; - m_CurTable = strTable; - m_bHumidity = rbHumidity.Checked; - return; - } - - string strTitle = ""; - double dMin = 0; - double dMax = 0; - if (rbHumidity.Checked == true) - { - strTitle = "Humidity"; + trendChart.AxisX[0].Title = "Humidity"; - trendChart.AxisX[0].Title = strTitle; - - ChartValues[] Points = { + ChartValues[] Points = { new ChartValues(), new ChartValues(), new ChartValues() }; - var Values = new List(); + var Values = new List(); - foreach (var pnt in Chart) - { - if(pnt.TEMPERATURE < 0) - Points[0].Add(new ScatterPoint(pnt.HUMIDITY, pnt.RPN, 2)); - else if(pnt.TEMPERATURE > 30) - Points[2].Add(new ScatterPoint(pnt.HUMIDITY, pnt.RPN, 2)); - else - Points[1].Add(new ScatterPoint(pnt.HUMIDITY, pnt.RPN, 2)); + foreach (var pnt in Chart) + { + if (pnt.TEMPERATURE < 0) + Points[0].Add(new ScatterPoint(pnt.HUMIDITY, pnt.RPN, 2)); + else if (pnt.TEMPERATURE > 30) + Points[2].Add(new ScatterPoint(pnt.HUMIDITY, pnt.RPN, 2)); + else + Points[1].Add(new ScatterPoint(pnt.HUMIDITY, pnt.RPN, 2)); - Values.Add(new TrendLine.POINT { X = pnt.HUMIDITY, Y = pnt.RPN }); - } + Values.Add(new TrendLine.POINT { X = pnt.HUMIDITY, Y = pnt.RPN }); + } - + Values.Sort((a, b) => (a.X == b.X) ? 0 : (a.X < b.X) ? -1 : 1); + TrendLine trendline = new TrendLine(Values); + ChartValues TrendPoints = new ChartValues(); + TrendPoints.Add(new ScatterPoint(Values[0].X, trendline.GetY(Values[0].X))); + TrendPoints.Add(new ScatterPoint(Values[Values.Count / 2].X, trendline.GetY(Values[Values.Count / 2].X))); + TrendPoints.Add(new ScatterPoint(Values[Values.Count - 1].X, trendline.GetY(Values[Values.Count - 1].X))); - Values.Sort((a, b) => (a.X == b.X) ? 0 : (a.X < b.X) ? -1 : 1); - TrendLine trendline = new TrendLine(Values); - ChartValues TrendPoints = new ChartValues(); - TrendPoints.Add(new ScatterPoint(Values[0].X, trendline.GetY(Values[0].X))); - TrendPoints.Add(new ScatterPoint(Values[Values.Count / 2].X, trendline.GetY(Values[Values.Count / 2].X))); - TrendPoints.Add(new ScatterPoint(Values[Values.Count - 1].X, trendline.GetY(Values[Values.Count - 1].X))); - - System.Windows.Media.SolidColorBrush[] brushes = { + System.Windows.Media.SolidColorBrush[] brushes = { System.Windows.Media.Brushes.DodgerBlue.Clone(), System.Windows.Media.Brushes.Green.Clone(), System.Windows.Media.Brushes.IndianRed.Clone() }; - foreach (var brush in brushes) - brush.Opacity = 0.75; + foreach (var brush in brushes) + brush.Opacity = 0.75; - trendChart.Series = new SeriesCollection + trendChart.Series = new SeriesCollection { new ScatterSeries { - Title = "~ 0℃", + Title = "Low Temp", Values = Points[0], Fill = brushes[0], - Foreground = new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(255, 255, 255, 255)), + LabelPoint = p => string.Format("{0:n2}, {1}", p.X, p.Y), }, new ScatterSeries { - Title = "0℃ ~ 30℃", + Title = "Mid Temp", Values = Points[1], Fill = brushes[1], + LabelPoint = p => string.Format("{0:n2}, {1}", p.X, p.Y), }, new ScatterSeries { - Title = "30℃ ~", + Title = "High Temp", Values = Points[2], Fill = brushes[2], + LabelPoint = p => string.Format("{0:n2}, {1}", p.X, p.Y), }, new LineSeries { @@ -216,83 +210,236 @@ namespace friction }; - dMin = Chart.Min(r => r.HUMIDITY - 1); - dMax = Chart.Max(r => r.HUMIDITY - 1); - } - else if(rbTemp.Checked == true) - { - strTitle = "Temperature"; - - trendChart.AxisX[0].Title = strTitle; - - ChartValues[] Points = { - new ChartValues(), - new ChartValues() }; - var Values = new List(); - - foreach (var pnt in Chart) - { - if(pnt.HUMIDITY <= 60) - Points[0].Add(new ScatterPoint(pnt.TEMPERATURE, pnt.RPN, 2)); - else - Points[1].Add(new ScatterPoint(pnt.TEMPERATURE, pnt.RPN, 2)); - - Values.Add(new TrendLine.POINT { X = pnt.TEMPERATURE, Y = pnt.RPN }); - } - - Values.Sort((a, b) => (a.X == b.X) ? 0 : (a.X TrendPoints = new ChartValues(); - TrendPoints.Add(new ScatterPoint(Values[0].X, trendline.GetY(Values[0].X))); - TrendPoints.Add(new ScatterPoint(Values[Values.Count / 2].X, trendline.GetY(Values[Values.Count / 2].X))); - TrendPoints.Add(new ScatterPoint(Values[Values.Count - 1].X, trendline.GetY(Values[Values.Count - 1].X))); - - trendChart.Series = new SeriesCollection - { - new ScatterSeries - { - Title = "~ 60%", - Values = Points[0], - Foreground = System.Windows.Media.Brushes.SkyBlue, - }, - new ScatterSeries - { - Title = "60% ~", - Values = Points[1], - Foreground = System.Windows.Media.Brushes.DarkBlue, - }, - new LineSeries - { - Title = "Trend", - Values = TrendPoints, - PointGeometry = DefaultGeometries.None, - StrokeThickness = 4, - }, - }; - - dMin = Chart.Min(r => r.TEMPERATURE - 1); - dMax = Chart.Max(r => r.TEMPERATURE - 1); - } - - - trendChart.AxisX[0].MinValue = dMin; - trendChart.AxisX[0].MaxValue = dMax; + trendChart.AxisX[0].MinValue = Chart.Min(r => r.HUMIDITY - 1); + trendChart.AxisX[0].MaxValue = Chart.Max(r => r.HUMIDITY - 1); m_CurSpring = strSpring; m_CurTable = strTable; - m_bHumidity = rbHumidity.Checked; + } - Console.WriteLine(string.Format("[end ] TrendGraph::UpdateGraph({0}, {1})", strSpring, strTable)); + private void UpdateGraphTemperature() + { + string strSpring = m_DataHandler.GetCurSpring(); + string strTable = m_DataHandler.GetCurTable(); + + var Chart = m_DataHandler.GetTrendChart(strSpring, strTable); + if (Chart.Count <= 0) + return; + + trendChart.AxisX[0].Title = "Temperature"; + + ChartValues[] Points = { + new ChartValues(), + new ChartValues() }; + var Values = new List(); + + foreach (var pnt in Chart) + { + if (pnt.HUMIDITY <= 60) + Points[0].Add(new ScatterPoint(pnt.TEMPERATURE, pnt.RPN, 2)); + else + Points[1].Add(new ScatterPoint(pnt.TEMPERATURE, pnt.RPN, 2)); + + Values.Add(new TrendLine.POINT { X = pnt.TEMPERATURE, Y = pnt.RPN }); + } + + Values.Sort((a, b) => (a.X == b.X) ? 0 : (a.X < b.X) ? -1 : 1); + TrendLine trendline = new TrendLine(Values); + ChartValues TrendPoints = new ChartValues(); + TrendPoints.Add(new ScatterPoint(Values[0].X, trendline.GetY(Values[0].X))); + TrendPoints.Add(new ScatterPoint(Values[Values.Count / 2].X, trendline.GetY(Values[Values.Count / 2].X))); + TrendPoints.Add(new ScatterPoint(Values[Values.Count - 1].X, trendline.GetY(Values[Values.Count - 1].X))); + + trendChart.Series = new SeriesCollection + { + new ScatterSeries + { + Title = "Low Humidity", + Values = Points[0], + Foreground = System.Windows.Media.Brushes.SkyBlue, + LabelPoint = p => string.Format("{0:n2}, {1}", p.X, p.Y), + }, + new ScatterSeries + { + Title = "High Humidity", + Values = Points[1], + Foreground = System.Windows.Media.Brushes.DarkBlue, + LabelPoint = p => string.Format("{0:n2}, {1}", p.X, p.Y), + }, + new LineSeries + { + Title = "Trend", + Values = TrendPoints, + PointGeometry = DefaultGeometries.None, + StrokeThickness = 4, + }, + }; + + + trendChart.AxisX[0].MinValue = Chart.Min(r => r.HUMIDITY - 1); + trendChart.AxisX[0].MaxValue = Chart.Max(r => r.HUMIDITY - 1); + } + + private void UpdateGraphForce() + { + string strSpring = m_DataHandler.GetCurSpring(); + string strTable = m_DataHandler.GetCurTable(); + + var Chart = m_DataHandler.GetTrendChart(strSpring, strTable); + if (Chart.Count <= 0) + return; + + trendChart.AxisX[0].Title = "Force"; + + var Points = new ChartValues(); + var Values = new List(); + + foreach (var pnt in Chart) + { + Points.Add(new ScatterPoint(pnt.FORCE, pnt.RPN, 2)); + Values.Add(new TrendLine.POINT { X = pnt.FORCE, Y = pnt.RPN }); + } + + Values.Sort((a, b) => (a.X == b.X) ? 0 : (a.X < b.X) ? -1 : 1); + TrendLine trendline = new TrendLine(Values); + ChartValues TrendPoints = new ChartValues(); + TrendPoints.Add(new ScatterPoint(Values[0].X, trendline.GetY(Values[0].X))); + TrendPoints.Add(new ScatterPoint(Values[Values.Count / 2].X, trendline.GetY(Values[Values.Count / 2].X))); + TrendPoints.Add(new ScatterPoint(Values[Values.Count - 1].X, trendline.GetY(Values[Values.Count - 1].X))); + + trendChart.Series = new SeriesCollection + { + new ScatterSeries + { + Title = "RPN by force", + Values = Points, + Foreground = System.Windows.Media.Brushes.SkyBlue, + LabelPoint = p => string.Format("{0:n2}, {1}", p.X, p.Y), + }, + new LineSeries + { + Title = "Trend", + Values = TrendPoints, + PointGeometry = DefaultGeometries.None, + StrokeThickness = 4, + }, + }; + + + trendChart.AxisX[0].MinValue = Chart.Min(r => r.HUMIDITY - 1); + trendChart.AxisX[0].MaxValue = Chart.Max(r => r.HUMIDITY - 1); + } + + private void UpdateGraphVelocity() + { + string strSpring = m_DataHandler.GetCurSpring(); + string strTable = m_DataHandler.GetCurTable(); + + var Chart = m_DataHandler.GetTrendChart(strSpring, strTable); + if (Chart.Count <= 0) + return; + + trendChart.AxisX[0].Title = "Velocity"; + + var Points = new ChartValues(); + var Values = new List(); + + foreach (var pnt in Chart) + { + Points.Add(new ScatterPoint(pnt.VELOCITY, pnt.RPN, 2)); + Values.Add(new TrendLine.POINT { X = pnt.VELOCITY, Y = pnt.RPN }); + } + + Values.Sort((a, b) => (a.X == b.X) ? 0 : (a.X < b.X) ? -1 : 1); + TrendLine trendline = new TrendLine(Values); + ChartValues TrendPoints = new ChartValues(); + TrendPoints.Add(new ScatterPoint(Values[0].X, trendline.GetY(Values[0].X))); + TrendPoints.Add(new ScatterPoint(Values[Values.Count / 2].X, trendline.GetY(Values[Values.Count / 2].X))); + TrendPoints.Add(new ScatterPoint(Values[Values.Count - 1].X, trendline.GetY(Values[Values.Count - 1].X))); + + trendChart.Series = new SeriesCollection + { + new ScatterSeries + { + Title = "RPN by velocity", + Values = Points, + Foreground = System.Windows.Media.Brushes.SkyBlue, + LabelPoint = p => string.Format("{0:n2}, {1}", p.X, p.Y), + }, + new LineSeries + { + Title = "Trend", + Values = TrendPoints, + PointGeometry = DefaultGeometries.None, + StrokeThickness = 4, + }, + }; + + + trendChart.AxisX[0].MinValue = Chart.Min(r => r.HUMIDITY - 1); + trendChart.AxisX[0].MaxValue = Chart.Max(r => r.HUMIDITY - 1); + } + + public void UpdateGraph(GRAPH_TYPE Type=GRAPH_TYPE.NONE) + { + if(Type == GRAPH_TYPE.NONE) + { + if (rbHumidity.Checked == true) + UpdateGraph(GRAPH_TYPE.HUMIDITY); + else if (rbTemp.Checked == true) + UpdateGraph(GRAPH_TYPE.TEMPERATURE); + else if (rbForce.Checked == true) + UpdateGraph(GRAPH_TYPE.FORCE); + else if (rbVelocity.Checked == true) + UpdateGraph(GRAPH_TYPE.VELOCITY); + return; + } + + string strSpring = m_DataHandler.GetCurSpring(); + string strTable = m_DataHandler.GetCurTable(); + + switch (Type) + { + case GRAPH_TYPE.HUMIDITY: + UpdateGraphHumidity(); + break; + + case GRAPH_TYPE.TEMPERATURE: + UpdateGraphTemperature(); + break; + + case GRAPH_TYPE.FORCE: + UpdateGraphForce(); + break; + + case GRAPH_TYPE.VELOCITY: + UpdateGraphVelocity(); + break; + } + + m_CurSpring = strSpring; + m_CurTable = strTable; + m_GraphType = Type; } private void rbHumidity_CheckedChanged(object sender, EventArgs e) { - UpdateGraph(); + UpdateGraph(GRAPH_TYPE.HUMIDITY); } private void rbTemp_CheckedChanged(object sender, EventArgs e) { - UpdateGraph(); + UpdateGraph(GRAPH_TYPE.TEMPERATURE); + } + + private void rbForce_CheckedChanged(object sender, EventArgs e) + { + UpdateGraph(GRAPH_TYPE.FORCE); + } + + private void rbVelocity_CheckedChanged(object sender, EventArgs e) + { + UpdateGraph(GRAPH_TYPE.VELOCITY); } } } diff --git a/Theme.cs b/Theme.cs index 69c4a08..d34a486 100644 --- a/Theme.cs +++ b/Theme.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Drawing; using System.Linq; +using System.Reflection; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; @@ -15,7 +16,6 @@ namespace friction public static Color Forecolor = Color.FromArgb(255, 235, 235, 235); public static Color Green = Color.LimeGreen; - //public static Color Yellow = Color.Gold; public static Color Yellow = Color.FromArgb(255, 255, 165, 0); public static Color Red = Color.OrangeRed; public static Color Gray = Color.DarkGray; @@ -37,6 +37,10 @@ namespace friction ctrl.ColumnHeadersDefaultCellStyle.ForeColor = Forecolor; ctrl.RowHeadersDefaultCellStyle.BackColor = Backcolor; ctrl.RowHeadersDefaultCellStyle.ForeColor = Forecolor; + + typeof(DataGridView).InvokeMember("DoubleBuffered", + BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty, + null, ctrl, new object[] { true }); } public static void Apply(ListView ctrl) @@ -50,6 +54,10 @@ namespace friction (sender, e) => ListViewHeaderDraw(sender, e, Backcolor, Forecolor) ); ctrl.DrawItem += new DrawListViewItemEventHandler(ListViewBodyDraw); + + typeof(ListView).InvokeMember("DoubleBuffered", + BindingFlags.NonPublic | BindingFlags.Instance | BindingFlags.SetProperty, + null, ctrl, new object[] { true }); } private static void ListViewHeaderDraw(object sender, DrawListViewColumnHeaderEventArgs e, Color backColor, Color foreColor)