private void MainChart_MouseMove(object sender, MouseEventArgs e) { if (e.Button.HasFlag(MouseButtons.Left)) { ChartArea ca = MainChart.ChartAreas[0]; Axis ax = ca.AxisX; Axis ay = ca.AxisY; int X = e.X, Y = e.Y; HitTestResult hit = MainChart.HitTest(e.X, e.Y); if (hit.PointIndex > 0) { curPoint = hit.Series.Points[hit.PointIndex]; } //if (curPoint != null) //{ // if (curPoint.XValue == 255 && curPoint.YValues[0] == 255) curPoint = null; // if (curPoint.XValue == 0 && curPoint.YValues[0] == 0) curPoint = null; // if (MainChart.Series[0].Points[MainChart.Series[0].Points.Count() - 1] == curPoint) curPoint = null; // if (MainChart.Series[0].Points[0] == curPoint) curPoint = null; //} if (curPoint != null) { Series s = hit.Series; double dx = ax.PixelPositionToValue(e.X); double dy = ay.PixelPositionToValue(e.Y); curPoint.XValue = dx; curPoint.YValues[0] = dy; } ObjectAPI pic2 = pic.Clone() as ObjectAPI; //pic2.ChangeGist(MainChart,str); Gist.Series[str2].Points.Clear(); if (flag == false) { Parallel.Invoke(() => Gist = Curve.loadGist(Gist, pic2, str2), () => pic2.ChangeGist(MainChart, str), () => MainPic.Image = pic2.ShowRGB()); } //MainPic.Image = pic2.ShowRGB(); else { Parallel.Invoke(() => Gist = Curve.loadGist(Gist, pic2, str2), () => pic2.ChangeGist(MainChart, str), () => MainPic.Image = pic2.Show()); } //MainPic.Image = pic2.Show(); MainPic.Refresh(); Gist = Curve.loadGist(Gist, pic2, str2); } }
private void MainChart_MouseClick(object sender, MouseEventArgs e) { if (e.Button.HasFlag(MouseButtons.Right)) { double X = Convert.ToDouble(Lx.Text); double Y = Convert.ToDouble(Ly.Text); DataPoint dp = new DataPoint(X, Y); dp.MarkerStyle = MarkerStyle.Square; dp.MarkerColor = Color.Red; var mass = MainChart.Series[str].Points.ToArray(); for (int i = 0; i < mass.Count(); i++) { if ((int)X == (int)mass[i].XValue) { return; } } MainChart.Series[str].Points.Add(dp); MainChart.Series[str].Sort(PointSortOrder.Ascending); ObjectAPI pic2 = pic.Clone() as ObjectAPI; //pic2.ChangeGist(MainChart,str); Gist.Series[str2].Points.Clear(); if (flag == false) { Parallel.Invoke(() => Gist = Curve.loadGist(Gist, pic2, str2), () => pic2.ChangeGist(MainChart, str), () => MainPic.Image = pic2.ShowRGB()); } //MainPic.Image = pic2.ShowRGB(); else { Parallel.Invoke(() => Gist = Curve.loadGist(Gist, pic2, str2), () => pic2.ChangeGist(MainChart, str), () => MainPic.Image = pic2.Show()); } //MainPic.Image = pic2.Show(); //Gist = Curve.loadGist(Gist, pic2, str2); MainPic.Refresh(); } }
private void Stream_SelectedIndexChanged(object sender, EventArgs e) { switch (Stream.SelectedItem) { case "Яркость": { MainPic.Refresh(); str = "Func"; str2 = "GI"; MainChart.Series["Func"].Enabled = true; MainChart.Series["RedStream"].Enabled = false; MainChart.Series["GreenStream"].Enabled = false; MainChart.Series["BlueStream"].Enabled = false; Gist.Series["GI"].Enabled = true; Gist.Series["GR"].Enabled = false; Gist.Series["GG"].Enabled = false; Gist.Series["GB"].Enabled = false; flag = false; break; } case "Серый канал": { MainPic.Refresh(); str = "Func"; str2 = "GI"; MainChart.Series["Func"].Enabled = true; MainChart.Series["RedStream"].Enabled = false; MainChart.Series["GreenStream"].Enabled = false; MainChart.Series["BlueStream"].Enabled = false; Gist.Series["GI"].Enabled = true; Gist.Series["GR"].Enabled = false; Gist.Series["GG"].Enabled = false; Gist.Series["GB"].Enabled = false; flag = true; break; } case "Красный канал": { MainPic.Refresh(); str = "RedStream"; str2 = "GR"; MainChart.Series["Func"].Enabled = false; MainChart.Series["RedStream"].Enabled = true; MainChart.Series["GreenStream"].Enabled = false; MainChart.Series["BlueStream"].Enabled = false; Gist.Series["GI"].Enabled = false; Gist.Series["GR"].Enabled = true; Gist.Series["GG"].Enabled = false; Gist.Series["GB"].Enabled = false; flag = false; break; } case "Зеленый канал": { MainPic.Refresh(); str = "GreenStream"; str2 = "GG"; MainChart.Series["Func"].Enabled = false; MainChart.Series["RedStream"].Enabled = false; MainChart.Series["GreenStream"].Enabled = true; MainChart.Series["BlueStream"].Enabled = false; Gist.Series["GI"].Enabled = false; Gist.Series["GR"].Enabled = false; Gist.Series["GG"].Enabled = true; Gist.Series["GB"].Enabled = false; flag = false; break; } case "Синий канал": { MainPic.Refresh(); str = "BlueStream"; str2 = "GB"; MainChart.Series["Func"].Enabled = false; MainChart.Series["RedStream"].Enabled = false; MainChart.Series["GreenStream"].Enabled = false; MainChart.Series["BlueStream"].Enabled = true; Gist.Series["GI"].Enabled = false; Gist.Series["GR"].Enabled = false; Gist.Series["GG"].Enabled = false; Gist.Series["GB"].Enabled = true; flag = false; break; } default: break; } }