From 0f99d4d12f2eae29bbe343f4b3131f2faeccda5d Mon Sep 17 00:00:00 2001 From: Shuxia Ning <NingShuxia0927@outlook.com> Date: 星期二, 14 一月 2025 17:31:20 +0800 Subject: [PATCH] 泵曲线修改 --- WinFrmUI/Yw.WinFrmUI.Phart.Core/03-valve/01-view/ValveViewChart.cs | 208 +++++++++++++++++++++++++-------------------------- 1 files changed, 103 insertions(+), 105 deletions(-) diff --git a/WinFrmUI/Yw.WinFrmUI.Phart.Core/03-valve/01-view/ValveViewChart.cs b/WinFrmUI/Yw.WinFrmUI.Phart.Core/03-valve/01-view/ValveViewChart.cs index a3d0bce..314fe81 100644 --- a/WinFrmUI/Yw.WinFrmUI.Phart.Core/03-valve/01-view/ValveViewChart.cs +++ b/WinFrmUI/Yw.WinFrmUI.Phart.Core/03-valve/01-view/ValveViewChart.cs @@ -1,6 +1,5 @@ 锘縰sing DevExpress.Utils; using DevExpress.XtraCharts; -using DevExpress.XtraSpreadsheet.Model; using Yw.Geometry; namespace Yw.WinFrmUI.Phart @@ -80,9 +79,9 @@ /// 閫変腑鐐� /// </summary> public event Action<int> SelectedPointIndexChangedEvent; - #endregion + #endregion - #region Initial + #region Private Initial /// <summary> /// 鍒濆鍖栧浘琛� @@ -191,8 +190,106 @@ } #endregion Initial + + #region Private Chart Event - #region SetBindingData + + private bool _on_move_x_flow_line = false; + private bool _on_move_x_opening_line = false; + private bool _on_move_y_k = false; + private void chartControl1_MouseDown(object sender, MouseEventArgs e) + { + if (!_initial_data) + return; + var hitInfo = chartControl1.CalcHitInfo(e.Location); + if (e.Button == MouseButtons.Left) + { + if (hitInfo.InConstantLine) + { + if (hitInfo.ConstantLine == _const_line_x_flow) + { + _on_move_x_flow_line = true; + } + else if (hitInfo.ConstantLine == _const_line_x_opening) + { + _on_move_x_opening_line = true; + } + else if (hitInfo.ConstantLine == _const_line_y_k) + { + _on_move_y_k = true; + } + } + } + + } + + private void chartControl1_MouseMove(object sender, MouseEventArgs e) + { + if (!_initial_data) + return; + + if (_on_move_x_flow_line) + { + var diagram_coordinates = _diagram.PointToDiagram(e.Location); + var axis_value = diagram_coordinates.GetAxisValue(_axis_x_flow); + if (axis_value == null) + return; + double x = axis_value.NumericalValue; + SetAxisXFlowValue(x); + + } + else if (_on_move_x_opening_line) + { + var diagram_coordinates = _diagram.PointToDiagram(e.Location); + var axis_value = diagram_coordinates.GetAxisValue(_axis_x_opening); + if (axis_value == null) + return; + double x = axis_value.NumericalValue; + SetAxisXOpeningValue(x); + } + else if (_on_move_y_k) + { + var diagram_coordinates = _diagram.PointToDiagram(e.Location); + var axis_value = diagram_coordinates.GetAxisValue(_axis_y_k); + if (axis_value == null) + return; + double y = axis_value.NumericalValue; + SetAxisYKValue(y); + } + else + { + var hitInfo = chartControl1.CalcHitInfo(e.Location); + if (hitInfo.InConstantLine) + { + this.chartControl1.Cursor = Cursors.Hand; + } + else if (hitInfo.InAnnotation) + { + this.chartControl1.Cursor = Cursors.SizeAll; + } + else + { + this.chartControl1.Cursor = Cursors.Default; + } + } + } + + private void chartControl1_MouseUp(object sender, MouseEventArgs e) + { + if (!_initial_data) + return; + _on_move_x_flow_line = false; + _on_move_x_opening_line = false; + _on_move_y_k = false; + } + + private void chartControl1_Resize(object sender, EventArgs e) + { + SetTextAnchorPoint(); + } + #endregion + + #region Set /// <summary> /// 缁戝畾鏁版嵁 @@ -203,8 +300,7 @@ _coordinate = null; _vm_list = null; _exist_ql = false; - _exist_ol = false; - + _exist_ol = false; this.chartControl1.BeginInit(); this.chartControl1.Series.Clear(); for (int i = this.chartControl1.AnnotationRepository.Count - 1; i > 0; i--) @@ -625,105 +721,7 @@ #endregion Calc - - #region Chart Event - - - private bool _on_move_x_flow_line = false; - private bool _on_move_x_opening_line = false; - private bool _on_move_y_k = false; - private void chartControl1_MouseDown(object sender, MouseEventArgs e) - { - if (!_initial_data) - return; - var hitInfo = chartControl1.CalcHitInfo(e.Location); - if (e.Button == MouseButtons.Left) - { - if (hitInfo.InConstantLine) - { - if (hitInfo.ConstantLine == _const_line_x_flow) - { - _on_move_x_flow_line = true; - } - else if (hitInfo.ConstantLine == _const_line_x_opening) - { - _on_move_x_opening_line = true; - } - else if (hitInfo.ConstantLine == _const_line_y_k) - { - _on_move_y_k = true; - } - } - } - - } - - private void chartControl1_MouseMove(object sender, MouseEventArgs e) - { - if (!_initial_data) - return; - - if (_on_move_x_flow_line) - { - var diagram_coordinates = _diagram.PointToDiagram(e.Location); - var axis_value = diagram_coordinates.GetAxisValue(_axis_x_flow); - if (axis_value == null) - return; - double x = axis_value.NumericalValue; - SetAxisXFlowValue(x); - - } - else if (_on_move_x_opening_line) - { - var diagram_coordinates = _diagram.PointToDiagram(e.Location); - var axis_value = diagram_coordinates.GetAxisValue(_axis_x_opening); - if (axis_value == null) - return; - double x = axis_value.NumericalValue; - SetAxisXOpeningValue(x); - } - else if (_on_move_y_k) - { - var diagram_coordinates = _diagram.PointToDiagram(e.Location); - var axis_value = diagram_coordinates.GetAxisValue(_axis_y_k); - if (axis_value == null) - return; - double y = axis_value.NumericalValue; - SetAxisYKValue(y); - } - else - { - var hitInfo = chartControl1.CalcHitInfo(e.Location); - if (hitInfo.InConstantLine) - { - this.chartControl1.Cursor = Cursors.Hand; - } - else if (hitInfo.InAnnotation) - { - this.chartControl1.Cursor = Cursors.SizeAll; - } - else - { - this.chartControl1.Cursor = Cursors.Default; - } - } - } - - private void chartControl1_MouseUp(object sender, MouseEventArgs e) - { - if (!_initial_data) - return; - _on_move_x_flow_line = false; - _on_move_x_opening_line = false; - _on_move_y_k = false; - } - - private void chartControl1_Resize(object sender, EventArgs e) - { - SetTextAnchorPoint(); - } - #endregion - + #region Set Axis Value /// <summary> -- Gitblit v1.9.3