private void chart1_MouseClick(object sender, MouseEventArgs e) { pr("MouseClick"); if (mouse_click_block) { mouse_click_block = false; return; } if (e.Button != MouseButtons.Left) { return; } Axis ax = chart1.ChartAreas[0].AxisX; int pos = (int)(ax.PixelPositionToValue(e.X)); if (pos < 0) { return; } if (pos >= miu.Length) { return; } SGHalfPeriod sghp = null; for (int i = 0; i < Msghp.Length - 1; i++) { if (pos >= Msghp[i].start && pos < Msghp[i + 1].start) { sghp = Msghp[i]; break; } } if (sghp == null) { return; } IU[] liu = new IU[sghp.size]; for (int i = 0; i < sghp.size; i++) { liu[i] = new IU(miu[sghp.start + i]); } using (FTubeHalfPeriod f = new FTubeHalfPeriod(TSName, liu, sghp)) { f.ShowDialog(); if (f.IsChange) { if (f.Ok == "Ok") { IsChandge = true; Close(); } else { prs("Не смогли записать пороги"); } } } }
public FTubeHalfPeriod(string _TSName, IU[] _iu, SGHalfPeriod _sghp) { InitializeComponent(); iu = _iu; ValIU = ParAll.SG.sgPars.ValIU; TSName = _TSName; DescValIU = new PARLIB.EnumTypeConverter(typeof(SGPars.EValIU)).Desc(ValIU); Text = _sghp.ToString(); }
private void FTubeGraph_Load(object sender, EventArgs e) { L_WindowLPars.CurrentWins.LoadFormRect(this); DataPointCollection pI = chart1.Series[0].Points; DataPointCollection pU = chart1.Series[1].Points; chart1.Series[1].Color = ValIU == SGPars.EValIU.U ? Color.Red : Color.Green; chart1.Series[1].LegendText = DescValIU; pP = chart1.Series[2].Points; for (int i = 0; i < miu.Length; i++) { pI.AddXY(i, miu[i].I); pU.AddXY(i, miu[i].Val(ValIU)); } MouseWheelHandler.Add(chart1, MyOnMouseWheel); ucTrack1.SetCount(miu.Length, zone); ucTrack1.ROnClick = TrackClick; int[] tresh = Tresh.Vals(TSName); for (int i = 0; i < Msghp.Length; i++) { SGHalfPeriod sghp = Msghp[i]; for (int j = 0; j < tresh.Length; j++) { if (tresh[j] >= sghp.size) { continue; } int pos = sghp.start + tresh[j]; int p = pP.AddXY(pos, miu[pos].Val(ValIU)); pP[p].Color = ValIU == SGPars.EValIU.U ? Color.Red : Color.Green; } } Axis ax = chart1.ChartAreas[0].AxisX; ax.Maximum = ax.Minimum + zone; }