| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065 | 
							- using System;
 
- using System.Collections;
 
- using System.Collections.Generic;
 
- using System.Drawing;
 
- using System.Drawing.Imaging;
 
- using System.Globalization;
 
- using System.IO;
 
- using System.Linq;
 
- using System.Reflection.Emit;
 
- using System.Windows;
 
- using System.Windows.Controls;
 
- using System.Windows.Input;
 
- using System.Windows.Media;
 
- using System.Windows.Media.Animation;
 
- using System.Windows.Media.Imaging;
 
- using Venus_Core;
 
- namespace Venus_Themes.UserControls
 
- {
 
-     /// <summary>
 
-     /// DrawGraphicsControl.xaml 的交互逻辑
 
-     /// </summary>
 
-     public partial class DrawGraphicsControl : UserControl
 
-     {
 
-         private double m_WavePlotX = 0;//x轴起始点
 
-         private double m_WavePlotY = 0;//y轴起始点
 
-         private double m_WavePlotWidth = 5000;//x轴长度
 
-         private double m_WavePlotHeight = 100;//y轴长度
 
-         private double m_WavePlotMinX = double.MaxValue;
 
-         private double m_WavePlotMaxX = double.MinValue;
 
-         private double m_WavePlotMinY = double.MaxValue;
 
-         private double m_WavePlotMaxY = double.MinValue;
 
-         private double m_StartDrawLineX = 0;
 
-         private System.Drawing.Brush m_BrushText = System.Drawing.Brushes.Black;
 
-         private System.Drawing.Brush m_BrushXYText = System.Drawing.Brushes.DarkRed;
 
-         private System.Drawing.Pen m_PenLine;
 
-         private System.Drawing.Pen m_PenLightGray;
 
-         private System.Drawing.Pen m_PenBlue;
 
-         private System.Drawing.Pen m_PenData;
 
-         private System.Drawing.Pen m_PenSData;
 
-         private System.Drawing.Pen m_PenASData;
 
-         public System.Drawing.Pen[] m_PenCollencteions;
 
-         public System.Drawing.Pen[] m_PenCollencteionsnew;
 
-         private bool m_StartMouseMove = false;
 
-         private bool m_MouseMove = false;
 
-         private bool m_MouseEnter = false;
 
-         private System.Windows.Point m_StartPoint;
 
-         private System.Windows.Point m_EndPoint;
 
-         private System.Windows.Point m_CurrentPoint;
 
-         private float LineThickness = 3.0f;
 
-         #region Property
 
-         public PointCollection PlotDataPoints
 
-         {
 
-             get { return (PointCollection)GetValue(PlotDataProperty); }
 
-             set { SetValue(PlotDataProperty, value); GraphicDraw(); }
 
-         }
 
-         /// <summary>
 
-         /// Identifies the DrawGraphicsControl.PlotDataPoints attached property. 
 
-         /// </summary>
 
-         public static readonly DependencyProperty PlotDataProperty =
 
-             DependencyProperty.RegisterAttached("PlotDataPoints", typeof(PointCollection), typeof(DrawGraphicsControl));
 
-         public PointCollection PlotSDataPoints
 
-         {
 
-             get { return (PointCollection)GetValue(PlotSDataProperty); }
 
-             set { SetValue(PlotSDataProperty, value); GraphicDraw(); }
 
-         }
 
-         /// <summary>
 
-         /// Identifies the DrawGraphicsControl.PlotSDataPoints attached property. 
 
-         /// </summary>
 
-         public static readonly DependencyProperty PlotSDataProperty =
 
-             DependencyProperty.RegisterAttached("PlotSDataPoints", typeof(PointCollection), typeof(DrawGraphicsControl));
 
-         public PointCollection PlotASDataPoints
 
-         {
 
-             get { return (PointCollection)GetValue(PlotASDataProperty); }
 
-             set { SetValue(PlotASDataProperty, value); GraphicDraw(); }
 
-         }
 
-         /// <summary>
 
-         /// Identifies the DrawGraphicsControl.PlotASDataPoints attached property. 
 
-         /// </summary>
 
-         public static readonly DependencyProperty PlotASDataProperty =
 
-             DependencyProperty.RegisterAttached("PlotASDataPoints", typeof(PointCollection), typeof(DrawGraphicsControl));
 
-         public List<PointCollection> PointCollections
 
-         {
 
-             get { return (List<PointCollection>)GetValue(PointCollectionsProperty); }
 
-             set { SetValue(PointCollectionsProperty, value); GraphicDraw(); }
 
-         }
 
-         /// <summary>
 
-         /// Identifies the DrawGraphicsControl.PointCollections attached property. 
 
-         /// </summary>
 
-         public static readonly DependencyProperty PointCollectionsProperty =
 
-             DependencyProperty.RegisterAttached("PointCollections", typeof(List<PointCollection>), typeof(DrawGraphicsControl));
 
-         public PointCollection Points
 
-         {
 
-             get { return (PointCollection)GetValue(PointsProperty); }
 
-             set { SetValue(PointsProperty, value); GraphicDraw(); }
 
-         }
 
-         /// <summary>
 
-         /// Identifies the DrawGraphicsControl.Points attached property. 
 
-         /// </summary>
 
-         public static readonly DependencyProperty PointsProperty =
 
-             DependencyProperty.RegisterAttached("Points", typeof(PointCollection), typeof(DrawGraphicsControl));
 
-         public List<StepItem> YPoints
 
-         {
 
-             get { return (List<StepItem>)GetValue(YPointsProperty); }
 
-             set { SetValue(YPointsProperty, value);  }
 
-         }
 
-         public static readonly DependencyProperty YPointsProperty =
 
-             DependencyProperty.RegisterAttached("YPoints", typeof(List<StepItem>), typeof(DrawGraphicsControl),new PropertyMetadata (new List<StepItem>()));
 
-         #region 起始坐标轴
 
-         public double WavePlotOriginX
 
-         {
 
-             get { return (double)GetValue(WavePlotOriginXProperty); }
 
-             set { SetValue(WavePlotOriginXProperty, value); }
 
-         }
 
-         public static readonly DependencyProperty WavePlotOriginXProperty =
 
-             DependencyProperty.Register("WavePlotOriginX", typeof(double), typeof(DrawGraphicsControl), new PropertyMetadata(0.0));
 
-         public double WavePlotOriginY
 
-         {
 
-             get { return (double)GetValue(WavePlotOriginYProperty); }
 
-             set { SetValue(WavePlotOriginYProperty, value); }
 
-         }
 
-         public static readonly DependencyProperty WavePlotOriginYProperty =
 
-             DependencyProperty.Register("WavePlotOriginY", typeof(double), typeof(DrawGraphicsControl), new PropertyMetadata(0.0));
 
-         public double WavePlotOriginWidth
 
-         {
 
-             get { return (double)GetValue(WavePlotOriginWidthProperty); }
 
-             set { SetValue(WavePlotOriginWidthProperty, value); }
 
-         }
 
-         public static readonly DependencyProperty WavePlotOriginWidthProperty =
 
-            DependencyProperty.Register("WavePlotOriginWidth", typeof(double), typeof(DrawGraphicsControl), new PropertyMetadata(1000.0));
 
-         public double WavePlotOriginHeight
 
-         {
 
-             get { return (double)GetValue(WavePlotOriginHeightProperty); }
 
-             set { SetValue(WavePlotOriginHeightProperty, value); }
 
-         }
 
-         public static readonly DependencyProperty WavePlotOriginHeightProperty =
 
-             DependencyProperty.Register("WavePlotOriginHeight", typeof(double), typeof(DrawGraphicsControl), new PropertyMetadata(1000.0));
 
-         #endregion
 
-         public bool IsHorizontalNavigationEnabled
 
-         {
 
-             get { return (bool)GetValue(IsHorizontalNavigationEnabledProperty); }
 
-             set { SetValue(IsHorizontalNavigationEnabledProperty, value); }
 
-         }
 
-         /// <summary>Identifies <see cref="IsHorizontalNavigationEnabled"/> property</summary>
 
-         public static readonly DependencyProperty IsHorizontalNavigationEnabledProperty =
 
-             DependencyProperty.Register("IsHorizontalNavigationEnabled", typeof(bool), typeof(DrawGraphicsControl), new PropertyMetadata(true));
 
-         public bool IsVerticalNavigationEnabled
 
-         {
 
-             get { return (bool)GetValue(IsVerticalNavigationEnabledProperty); }
 
-             set { SetValue(IsVerticalNavigationEnabledProperty, value); }
 
-         }
 
-         /// <summary>Identifies <see cref="IsVerticalNavigationEnabled"/> property</summary>
 
-         public static readonly DependencyProperty IsVerticalNavigationEnabledProperty =
 
-             DependencyProperty.Register("IsVerticalNavigationEnabled", typeof(bool), typeof(DrawGraphicsControl), new PropertyMetadata(true));
 
-         public bool IsHorizontalDateTimeAxis
 
-         {
 
-             get { return (bool)GetValue(IsHorizontalDateTimeAxisProperty); }
 
-             set { SetValue(IsHorizontalDateTimeAxisProperty, value); }
 
-         }
 
-         /// <summary>Identifies <see cref="IsVerticalNavigationEnabled"/> property</summary>
 
-         public static readonly DependencyProperty IsHorizontalDateTimeAxisProperty =
 
-             DependencyProperty.Register("IsHorizontalDateTimeAxis", typeof(bool), typeof(DrawGraphicsControl), new PropertyMetadata(false));
 
-         #endregion Property
 
-         public DrawGraphicsControl()
 
-         {
 
-             InitializeComponent();
 
-             m_PenLine = new System.Drawing.Pen(System.Drawing.Brushes.Black, 1);
 
-             m_PenLightGray = new System.Drawing.Pen(System.Drawing.Brushes.DarkGray, 1);
 
-             m_PenBlue = new System.Drawing.Pen(System.Drawing.Brushes.DarkBlue, 1);
 
-             m_PenData = new System.Drawing.Pen(System.Drawing.Brushes.Green, 1);
 
-             m_PenSData = new System.Drawing.Pen(System.Drawing.Brushes.Blue, 1);
 
-             m_PenASData = new System.Drawing.Pen(System.Drawing.Brushes.Red, 1);
 
-             m_PenCollencteions = new System.Drawing.Pen[]
 
-             {
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.Green,LineThickness),
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.Red,LineThickness),
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.Blue,LineThickness),
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.Orange,LineThickness),
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.Yellow,LineThickness),
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.YellowGreen,LineThickness),
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.AliceBlue,LineThickness),
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.Chocolate,LineThickness),
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.Cyan,LineThickness),
 
-                 new System.Drawing.Pen(System.Drawing.Brushes.DarkGreen,LineThickness),
 
-                 //new System.Drawing.Pen(System.Drawing.Brushes.LightBlue,LineThickness),
 
-                 //new System.Drawing.Pen(System.Drawing.Brushes.DarkBlue,LineThickness),
 
-                 //new System.Drawing.Pen(System.Drawing.Brushes.Pink,LineThickness),
 
-                 //new System.Drawing.Pen(System.Drawing.Brushes.DarkViolet,LineThickness),
 
-                 //new System.Drawing.Pen(System.Drawing.Brushes.Cyan,LineThickness),
 
-                 //new System.Drawing.Pen(System.Drawing.Brushes.HotPink,LineThickness),
 
-             };
 
-             IsHorizontalNavigationEnabled = false;
 
-             IsVerticalNavigationEnabled = false;
 
-         }
 
-         #region Public
 
-         public void ResetCoordinate()
 
-         {
 
-             m_WavePlotX = WavePlotOriginX;
 
-             m_WavePlotY = WavePlotOriginY;
 
-             m_WavePlotWidth = WavePlotOriginWidth;
 
-             m_WavePlotHeight = WavePlotOriginHeight;
 
-             GraphicDraw();
 
-         }
 
-         public void ResetControl()
 
-         {
 
-             GraphicDraw();
 
-         }
 
-         public void FitControl()
 
-         {
 
-             if (!double.IsNaN(m_WavePlotMinX) && !double.IsNaN(m_WavePlotMaxX) && !double.IsNaN(m_WavePlotMinY) && !double.IsNaN(m_WavePlotMaxY)
 
-                 && m_WavePlotMinX != double.MaxValue && m_WavePlotMaxX != double.MinValue && m_WavePlotMinY != double.MaxValue && m_WavePlotMaxY != double.MinValue)
 
-             {
 
-                 m_WavePlotX = m_WavePlotMinX;
 
-                 m_WavePlotWidth = m_WavePlotMaxX - m_WavePlotMinX;
 
-                 m_WavePlotY = m_WavePlotMinY-1;
 
-                 m_WavePlotHeight = m_WavePlotMaxY - m_WavePlotMinY+2;
 
-                 GraphicDraw();
 
-             }
 
-         }
 
-         public void FitControlWithoutDrawing()
 
-         {
 
-             m_WavePlotX = m_WavePlotMinX;
 
-             m_WavePlotWidth = m_WavePlotMaxX - m_WavePlotMinX;
 
-             m_WavePlotY = m_WavePlotMinY - 1;
 
-             m_WavePlotHeight = m_WavePlotMaxY - m_WavePlotMinY + 2;
 
-         }
 
-         public void ClearPlot()
 
-         {
 
-             Points = new PointCollection();
 
-         }
 
-         public void ClearPlotPoints()
 
-         {
 
-             PointCollections = new List<PointCollection>();
 
-         }
 
-         public void Plot(IEnumerable x, IEnumerable y, int count = 0)
 
-         {
 
-             if (x == null || y == null) return;
 
-             if (Points == null || count == 0) Points = new PointCollection();
 
-             var enx = x.GetEnumerator();
 
-             var eny = y.GetEnumerator();
 
-             while (true)
 
-             {
 
-                 var nx = enx.MoveNext();
 
-                 var ny = eny.MoveNext();
 
-                 if (nx && ny)
 
-                     Points.Add(new System.Windows.Point(Convert.ToSingle(enx.Current, CultureInfo.InvariantCulture),
 
-                         Convert.ToSingle(eny.Current, CultureInfo.InvariantCulture)));
 
-                 else if (!nx && !ny)
 
-                     break;
 
-                 else
 
-                     throw new ArgumentException("x and y have different lengthes");
 
-                 if (count > 0 && Points.Count > count) Points.RemoveAt(0);
 
-             }
 
-         }
 
-         public void PlotY(IEnumerable y, int count = 0)
 
-         {
 
-             if (y == null) return;
 
-             if (Points == null || count == 0) Points = new PointCollection();
 
-             int x = 0;
 
-             var en = y.GetEnumerator();
 
-             while (en.MoveNext())
 
-             {
 
-                 Points.Add(new System.Windows.Point(x++, Convert.ToSingle(en.Current, CultureInfo.InvariantCulture)));
 
-                 if (count > 0 && Points.Count > count) Points.RemoveAt(0);
 
-             }
 
-         }
 
-         public void PlotPoints(IEnumerable x, IEnumerable y, int count = 0)
 
-         {
 
-             if (x == null || y == null)
 
-             {
 
-                 PointCollections = new List<PointCollection>();
 
-                 return;
 
-             }
 
-             if (PointCollections == null || count == 0) PointCollections = new List<PointCollection>();
 
-             var points = new PointCollection();
 
-             var enx = x.GetEnumerator();
 
-             var eny = y.GetEnumerator();
 
-             while (true)
 
-             {
 
-                 var nx = enx.MoveNext();
 
-                 var ny = eny.MoveNext();
 
-                 if (nx && ny)
 
-                     points.Add(new System.Windows.Point(Convert.ToSingle(enx.Current, CultureInfo.InvariantCulture),
 
-                         Convert.ToSingle(eny.Current, CultureInfo.InvariantCulture)));
 
-                 else if (!nx && !ny)
 
-                     break;
 
-                 else
 
-                     throw new ArgumentException("x and y have different lengthes");
 
-             }
 
-             PointCollections.Add(points);
 
-             if (count > 0 && PointCollections.Count > count) PointCollections.RemoveAt(0);
 
-             PointCollections = PointCollections;
 
-         }
 
-         public void PlotPointYs(IEnumerable y, int count = 0)
 
-         {
 
-             if (y == null) return;
 
-             if (PointCollections == null || count == 0) PointCollections = new List<PointCollection>();
 
-             var points = new PointCollection();
 
-             int x = 0;
 
-             var en = y.GetEnumerator();
 
-             while (en.MoveNext())
 
-             {
 
-                 points.Add(new System.Windows.Point(x++, Convert.ToSingle(en.Current, CultureInfo.InvariantCulture)));
 
-             }
 
-             PointCollections.Add(points);
 
-             if (count > 0 && PointCollections.Count > count) PointCollections.RemoveAt(0);
 
-         }
 
-         public void PlotData(IEnumerable x, IEnumerable y)
 
-         {
 
-             if (x == null || y == null)
 
-             {
 
-                 PlotDataPoints = new PointCollection();
 
-                 return;
 
-             }
 
-             var points = new PointCollection();
 
-             var enx = x.GetEnumerator();
 
-             var eny = y.GetEnumerator();
 
-             while (true)
 
-             {
 
-                 var nx = enx.MoveNext();
 
-                 var ny = eny.MoveNext();
 
-                 if (nx && ny)
 
-                     points.Add(new System.Windows.Point(Convert.ToDouble(enx.Current, CultureInfo.InvariantCulture),
 
-                         Convert.ToDouble(eny.Current, CultureInfo.InvariantCulture)));
 
-                 else if (!nx && !ny)
 
-                     break;
 
-                 else
 
-                     throw new ArgumentException("x and y have different lengthes");
 
-             }
 
-             PlotDataPoints = points;
 
-         }
 
-         public void PlotSData(IEnumerable x, IEnumerable y)
 
-         {
 
-             if (x == null || y == null)
 
-             {
 
-                 PlotSDataPoints = new PointCollection();
 
-                 return;
 
-             }
 
-             var points = new PointCollection();
 
-             var enx = x.GetEnumerator();
 
-             var eny = y.GetEnumerator();
 
-             while (true)
 
-             {
 
-                 var nx = enx.MoveNext();
 
-                 var ny = eny.MoveNext();
 
-                 if (nx && ny)
 
-                     points.Add(new System.Windows.Point(Convert.ToDouble(enx.Current, CultureInfo.InvariantCulture),
 
-                         Convert.ToDouble(eny.Current, CultureInfo.InvariantCulture)));
 
-                 else if (!nx && !ny)
 
-                     break;
 
-                 else
 
-                     throw new ArgumentException("x and y have different lengthes");
 
-             }
 
-             PlotSDataPoints = points;
 
-         }
 
-         public void PlotASData(IEnumerable x, IEnumerable y)
 
-         {
 
-             if (x == null || y == null)
 
-             {
 
-                 PlotASDataPoints = new PointCollection();
 
-                 return;
 
-             }
 
-             var points = new PointCollection();
 
-             var enx = x.GetEnumerator();
 
-             var eny = y.GetEnumerator();
 
-             while (true)
 
-             {
 
-                 var nx = enx.MoveNext();
 
-                 var ny = eny.MoveNext();
 
-                 if (nx && ny)
 
-                     points.Add(new System.Windows.Point(Convert.ToDouble(enx.Current, CultureInfo.InvariantCulture),
 
-                         Convert.ToDouble(eny.Current, CultureInfo.InvariantCulture)));
 
-                 else if (!nx && !ny)
 
-                     break;
 
-                 else
 
-                     throw new ArgumentException("x and y have different lengthes");
 
-             }
 
-             PlotASDataPoints = points;
 
-         }
 
-         /// <summary>
 
-         /// 获取小数位数
 
-         /// </summary>
 
-         /// <param name="decimalV">小数</param>
 
-         /// <returns></returns>
 
-         public int GetNumberOfDecimalPlaces(double decimalV)
 
-         {
 
-             string[] temp = decimalV.ToString().Split('.');
 
-             if (temp.Length == 2 && temp[1].Length > 0)
 
-             {
 
-                 int index = temp[1].Length - 1;
 
-                 while (temp[1][index] == '0' && index-- > 0) ;
 
-                 return index + 1;
 
-             }
 
-             return 0;
 
-         }
 
-         #endregion Public
 
-         #region Private Draw
 
-         //public void GraphicDrawplotsally()
 
-         //{
 
-         //    if (Canvas_Main.ActualWidth <= 0 || Canvas_Main.ActualHeight <= 0) return;
 
-         //    m_WavePlotMinX = double.MaxValue;
 
-         //    m_WavePlotMaxX = double.MinValue;
 
-         //    m_WavePlotMinY = double.MaxValue;
 
-         //    m_WavePlotMaxY = double.MinValue;
 
-         //    using (Bitmap bitmap = new Bitmap((int)Canvas_Main.ActualWidth, (int)Canvas_Main.ActualHeight))
 
-         //    {
 
-         //        Graphics graphics = Graphics.FromImage(bitmap);
 
-         //        if (m_WavePlotHeight < Math.Pow(10, -4))
 
-         //        {
 
-         //            double Min = m_WavePlotY;
 
-         //            double Max = m_WavePlotY + m_WavePlotHeight;
 
-         //            double delta = (Max - Min) / 2;
 
-         //            double center = (Max + Min) / 2;
 
-         //            Min = center - delta * 1.2;
 
-         //            Max = center + delta * 1.2;
 
-         //            m_WavePlotY = Min;
 
-         //            m_WavePlotHeight = Max - Min;
 
-         //        }
 
-         //    }
 
-         //}
 
-         private void GraphicDraw()
 
-         {
 
-             if (Canvas_Main.ActualWidth <= 0 || Canvas_Main.ActualHeight <= 0) return;
 
-             m_WavePlotMinX = double.MaxValue;
 
-             m_WavePlotMaxX = double.MinValue;
 
-             m_WavePlotMinY = double.MaxValue;
 
-             m_WavePlotMaxY = double.MinValue;
 
-             using (Bitmap bitmap = new Bitmap((int)Canvas_Main.ActualWidth, (int)Canvas_Main.ActualHeight))
 
-             {
 
-                 Graphics graphics = Graphics.FromImage(bitmap);
 
-                 //纵坐标 
 
-                 if (m_WavePlotHeight < Math.Pow(10, -4))
 
-                 {
 
-                     double Min = m_WavePlotY;
 
-                     double Max = m_WavePlotY + m_WavePlotHeight;
 
-                     double delta = (Max - Min) / 2;
 
-                     double center = (Max + Min) / 2;
 
-                     Min = center - delta * 1.2;
 
-                     Max = center + delta * 1.2;
 
-                     m_WavePlotY = Min;
 
-                     m_WavePlotHeight = Max - Min;
 
-                 }
 
-                 if (m_WavePlotHeight > Math.Pow(10, -4))
 
-                 {
 
-                     int IntervalTextY; int ExpCountY;
 
-                     GetIntervalValue(m_WavePlotY, m_WavePlotY + m_WavePlotHeight, out IntervalTextY, out ExpCountY);
 
-                     int StartIndexY = (int)(m_WavePlotY / (IntervalTextY * Math.Pow(10, ExpCountY)));
 
-                     int EndIndexY = (int)((m_WavePlotY + m_WavePlotHeight) / (IntervalTextY * Math.Pow(10, ExpCountY)));
 
-                     int DrawStringLength = 0;
 
-                     //寻找显示最长字符串
 
-                     for (int i = StartIndexY; i <= EndIndexY; i++)
 
-                     {
 
-                         if (DrawStringLength < ChangeDataToD((i * IntervalTextY * Math.Pow(10, ExpCountY)).ToString()).ToString().Length) DrawStringLength = ChangeDataToD((i * IntervalTextY * Math.Pow(10, ExpCountY)).ToString()).ToString().Length;
 
-                     }
 
-                     m_StartDrawLineX = (DrawStringLength + 5) * 5;
 
-                     for (int i = StartIndexY; i <= EndIndexY; i++)
 
-                     {
 
-                         if (i == StartIndexY && (i * IntervalTextY * Math.Pow(10, ExpCountY)) < m_WavePlotY) continue;
 
-                         if (i == EndIndexY && (i * IntervalTextY * Math.Pow(10, ExpCountY)) > m_WavePlotY + m_WavePlotHeight) continue;
 
-                         double Y = Canvas_Main.ActualHeight - 50 - ((Canvas_Main.ActualHeight - 50.0) / m_WavePlotHeight) * (i * IntervalTextY * Math.Pow(10, ExpCountY) - m_WavePlotY);
 
-                         if (Y < 0) Y = 0;
 
-                         if (Y > Canvas_Main.ActualHeight - 50) Y = Canvas_Main.ActualHeight - 50;
 
-                         graphics.DrawLine(m_PenLightGray, new PointF((float)m_StartDrawLineX, (float)Y), new PointF((float)(Canvas_Main.ActualWidth), (float)Y));
 
-                         graphics.DrawLine(m_PenLine, new PointF((float)m_StartDrawLineX, (float)Y), new PointF((float)m_StartDrawLineX - 10, (float)Y));
 
-                         graphics.DrawString(ChangeDataToD((i * IntervalTextY * Math.Pow(10, ExpCountY)).ToString()).ToString(), System.Drawing.SystemFonts.DefaultFont, m_BrushText, new PointF(0, (float)(Y - 5)));
 
-                     }
 
-                 }
 
-                 //横坐标
 
-                 if (m_WavePlotWidth < Math.Pow(10, -4))
 
-                 {
 
-                     double Min = m_WavePlotX;
 
-                     double Max = m_WavePlotX + m_WavePlotWidth;
 
-                     double delta = (Max - Min) / 2;
 
-                     double center = (Max + Min) / 2;
 
-                     Min = center - delta * 1.2;
 
-                     Max = center + delta * 1.2;
 
-                     m_WavePlotX = Min;
 
-                     m_WavePlotWidth = Max - Min;
 
-                 }
 
-                 if (m_WavePlotWidth > Math.Pow(10, -4))
 
-                 {
 
-                     int IntervalTextX; int ExpCountX;
 
-                     GetIntervalValue(m_WavePlotX, m_WavePlotX + m_WavePlotWidth, out IntervalTextX, out ExpCountX);
 
-                     int StartIndexX = (int)(m_WavePlotX / (IntervalTextX * Math.Pow(10, ExpCountX)));
 
-                     int EndIndexX = (int)((m_WavePlotX + m_WavePlotWidth) / (IntervalTextX * Math.Pow(10, ExpCountX)));
 
-                     for (int i = StartIndexX; i <= EndIndexX; i++)
 
-                     {
 
-                         if (i == StartIndexX && (i * IntervalTextX * Math.Pow(10, ExpCountX)) < m_WavePlotX) continue;
 
-                         if (i == EndIndexX && (i * IntervalTextX * Math.Pow(10, ExpCountX)) > m_WavePlotX + m_WavePlotWidth) continue;
 
-                         double X = m_StartDrawLineX + ((Canvas_Main.ActualWidth - m_StartDrawLineX) / m_WavePlotWidth) * (i * IntervalTextX * Math.Pow(10, ExpCountX) - m_WavePlotX);
 
-                         if (X < m_StartDrawLineX) X = m_StartDrawLineX;
 
-                         if (X > Canvas_Main.ActualWidth) X = Canvas_Main.ActualWidth;
 
-                         graphics.DrawLine(m_PenLightGray, new PointF((float)X, 0), new PointF((float)X, (float)Canvas_Main.ActualHeight - 50));
 
-                         graphics.DrawLine(m_PenLine, new PointF((float)X, (float)Canvas_Main.ActualHeight - 30), new PointF((float)X, (float)Canvas_Main.ActualHeight - 50));
 
-                         if (IsHorizontalDateTimeAxis)
 
-                         {
 
-                             graphics.DrawString(DateTime.FromOADate((double)ChangeDataToD((i * IntervalTextX * Math.Pow(10, ExpCountX)).ToString())).ToString("yyyy-MM-dd HH:mm:ss"), System.Drawing.SystemFonts.DefaultFont, m_BrushText, new PointF((float)X - 10, (float)Canvas_Main.ActualHeight - 30));
 
-                         }
 
-                         else
 
-                         {
 
-                             graphics.DrawString(ChangeDataToD((i * IntervalTextX * Math.Pow(10, ExpCountX)).ToString()).ToString(), System.Drawing.SystemFonts.DefaultFont, m_BrushText, new PointF((float)X - 10, (float)Canvas_Main.ActualHeight - 30));
 
-                         }
 
-                     }
 
-                 }
 
-                 //画边框
 
-                 graphics.DrawLine(m_PenLine, new PointF((float)m_StartDrawLineX, 0), new PointF((float)m_StartDrawLineX, (float)Canvas_Main.ActualHeight - 50));
 
-                 graphics.DrawLine(m_PenLine, new PointF((float)m_StartDrawLineX, 0), new PointF((float)(Canvas_Main.ActualWidth), 0));
 
-                 graphics.DrawLine(m_PenLine, new PointF((float)m_StartDrawLineX, (float)(Canvas_Main.ActualHeight - 50)), new PointF((float)Canvas_Main.ActualWidth, (float)(Canvas_Main.ActualHeight - 50)));
 
-                 graphics.DrawLine(m_PenLine, new PointF((float)Canvas_Main.ActualWidth - 1, 0), new PointF((float)Canvas_Main.ActualWidth - 1, (float)(Canvas_Main.ActualHeight - 50)));
 
-                
 
-                 if (this.PlotDataPoints != null && this.PlotDataPoints.Count > 0)
 
-                 {
 
-                     List<PointF> points = new List<PointF>();
 
-                     for (int i = 0; i < PlotDataPoints.Count; i++)
 
-                     {
 
-                         if (PlotDataPoints[i].X >= m_WavePlotX && PlotDataPoints[i].X <= m_WavePlotX + m_WavePlotWidth)
 
-                         {
 
-                             double StartX = m_StartDrawLineX + (Canvas_Main.ActualWidth - m_StartDrawLineX) / m_WavePlotWidth * (PlotDataPoints[i].X - m_WavePlotX);
 
-                             if (StartX < m_StartDrawLineX || PlotDataPoints[i].X < m_WavePlotX) StartX = m_StartDrawLineX;
 
-                             if (StartX > Canvas_Main.ActualWidth || PlotDataPoints[i].X > m_WavePlotX + m_WavePlotWidth) StartX = Canvas_Main.ActualWidth;
 
-                             double StartY = Canvas_Main.ActualHeight - 50 - (Canvas_Main.ActualHeight - 50.0) / m_WavePlotHeight * (PlotDataPoints[i].Y - m_WavePlotY);
 
-                             if (StartY < 0 || PlotDataPoints[i].Y > m_WavePlotY + m_WavePlotHeight) StartY = 0;
 
-                             if (StartY > Canvas_Main.ActualHeight - 50 || PlotDataPoints[i].Y < m_WavePlotY) StartY = Canvas_Main.ActualHeight - 50;
 
-                             points.Add(new PointF((float)StartX, (float)StartY));
 
-                         }
 
-                         if (m_WavePlotMinX == double.MaxValue || m_WavePlotMinX > PlotDataPoints[i].X) m_WavePlotMinX = PlotDataPoints[i].X;
 
-                         if (m_WavePlotMaxX == double.MinValue || m_WavePlotMaxX < PlotDataPoints[i].X) m_WavePlotMaxX = PlotDataPoints[i].X;
 
-                         if (m_WavePlotMinY == double.MaxValue || m_WavePlotMinY > PlotDataPoints[i].Y) m_WavePlotMinY = PlotDataPoints[i].Y;
 
-                         if (m_WavePlotMaxY == double.MinValue || m_WavePlotMaxY < PlotDataPoints[i].Y) m_WavePlotMaxY = PlotDataPoints[i].Y;
 
-                     }
 
-                     if (points.Count > 1 && points.Where(_ => float.IsNaN(_.X) || float.IsNaN(_.Y)).ToList<PointF>().Count == 0) graphics.DrawLines(m_PenData, points.ToArray());
 
-                 }
 
-                 if (this.PlotSDataPoints != null && this.PlotSDataPoints.Count > 0)
 
-                 {
 
-                     List<PointF> points = new List<PointF>();
 
-                     for (int i = 0; i < PlotSDataPoints.Count; i++)
 
-                     {
 
-                         if (PlotSDataPoints[i].X >= m_WavePlotX && PlotSDataPoints[i].X <= m_WavePlotX + m_WavePlotWidth)
 
-                         {
 
-                             double StartX = 50 + (Canvas_Main.ActualWidth - m_StartDrawLineX) / m_WavePlotWidth * (PlotSDataPoints[i].X - m_WavePlotX);
 
-                             if (StartX < m_StartDrawLineX || PlotSDataPoints[i].X < m_WavePlotX) StartX = m_StartDrawLineX;
 
-                             if (StartX > Canvas_Main.ActualWidth || PlotSDataPoints[i].X > m_WavePlotX + m_WavePlotWidth) StartX = Canvas_Main.ActualWidth;
 
-                             double StartY = Canvas_Main.ActualHeight - 50 - (Canvas_Main.ActualHeight - 50.0) / m_WavePlotHeight * (PlotSDataPoints[i].Y - m_WavePlotY);
 
-                             if (StartY < 0 || PlotSDataPoints[i].Y > m_WavePlotY + m_WavePlotHeight) StartY = 0;
 
-                             if (StartY > Canvas_Main.ActualHeight - 50 || PlotSDataPoints[i].Y < m_WavePlotY) StartY = Canvas_Main.ActualHeight - 50;
 
-                             points.Add(new PointF((float)StartX, (float)StartY));
 
-                         }
 
-                         if (double.IsNaN(m_WavePlotMinX) || m_WavePlotMinX > PlotSDataPoints[i].X) m_WavePlotMinX = PlotSDataPoints[i].X;
 
-                         if (double.IsNaN(m_WavePlotMaxX) || m_WavePlotMaxX < PlotSDataPoints[i].X) m_WavePlotMaxX = PlotSDataPoints[i].X;
 
-                         if (double.IsNaN(m_WavePlotMinY) || m_WavePlotMinY > PlotSDataPoints[i].Y) m_WavePlotMinY = PlotSDataPoints[i].Y;
 
-                         if (double.IsNaN(m_WavePlotMaxY) || m_WavePlotMaxY < PlotSDataPoints[i].Y) m_WavePlotMaxY = PlotSDataPoints[i].Y;
 
-                     }
 
-                     if (points.Count > 1 && points.Where(_ => float.IsNaN(_.X) || float.IsNaN(_.Y)).ToList<PointF>().Count == 0) graphics.DrawLines(m_PenSData, points.ToArray());
 
-                 }
 
-                 if (this.PlotASDataPoints != null && this.PlotASDataPoints.Count > 0)
 
-                 {
 
-                     List<PointF> points = new List<PointF>();
 
-                     for (int i = 0; i < PlotASDataPoints.Count; i++)
 
-                     {
 
-                         if (PlotASDataPoints[i].X >= m_WavePlotX && PlotASDataPoints[i].X <= m_WavePlotX + m_WavePlotWidth)
 
-                         {
 
-                             double StartX = m_StartDrawLineX + (Canvas_Main.ActualWidth - m_StartDrawLineX) / m_WavePlotWidth * (PlotASDataPoints[i].X - m_WavePlotX);
 
-                             if (StartX < m_StartDrawLineX || PlotASDataPoints[i].X < m_WavePlotX) StartX = m_StartDrawLineX;
 
-                             if (StartX > Canvas_Main.ActualWidth || PlotASDataPoints[i].X > m_WavePlotX + m_WavePlotWidth) StartX = Canvas_Main.ActualWidth;
 
-                             double StartY = Canvas_Main.ActualHeight - 50 - (Canvas_Main.ActualHeight - 50.0) / m_WavePlotHeight * (PlotASDataPoints[i].Y - m_WavePlotY);
 
-                             if (StartY < 0 || PlotASDataPoints[i].Y > m_WavePlotY + m_WavePlotHeight) StartY = 0;
 
-                             if (StartY > Canvas_Main.ActualHeight - 50 || PlotASDataPoints[i].Y < m_WavePlotY) StartY = Canvas_Main.ActualHeight - 50;
 
-                             points.Add(new PointF((float)StartX, (float)StartY));
 
-                         }
 
-                         if (m_WavePlotMinX == double.MaxValue || m_WavePlotMinX > PlotASDataPoints[i].X) m_WavePlotMinX = PlotASDataPoints[i].X;
 
-                         if (m_WavePlotMaxX == double.MinValue || m_WavePlotMaxX < PlotASDataPoints[i].X) m_WavePlotMaxX = PlotASDataPoints[i].X;
 
-                         if (m_WavePlotMinY == double.MaxValue || m_WavePlotMinY > PlotASDataPoints[i].Y) m_WavePlotMinY = PlotASDataPoints[i].Y;
 
-                         if (m_WavePlotMaxY == double.MinValue || m_WavePlotMaxY < PlotASDataPoints[i].Y) m_WavePlotMaxY = PlotASDataPoints[i].Y;
 
-                     }
 
-                     if (points.Count > 1 && points.Where(_ => float.IsNaN(_.X) || float.IsNaN(_.Y)).ToList<PointF>().Count == 0) graphics.DrawLines(m_PenASData, points.ToArray());
 
-                 }
 
-                 if (this.Points != null && this.Points.Count > 0)
 
-                 {
 
-                     List<PointF> points = new List<PointF>();
 
-                     for (int i = 0; i < Points.Count; i++)
 
-                     {
 
-                         if (Points[i].X >= m_WavePlotX && Points[i].X <= m_WavePlotX + m_WavePlotWidth)
 
-                         {
 
-                             double StartX = m_StartDrawLineX + (Canvas_Main.ActualWidth - m_StartDrawLineX) / m_WavePlotWidth * (Points[i].X - m_WavePlotX);
 
-                             if (StartX < m_StartDrawLineX || Points[i].X < m_WavePlotX) StartX = m_StartDrawLineX;
 
-                             if (StartX > Canvas_Main.ActualWidth || Points[i].X > m_WavePlotX + m_WavePlotWidth) StartX = Canvas_Main.ActualWidth;
 
-                             double StartY = Canvas_Main.ActualHeight - 50 - (Canvas_Main.ActualHeight - 50.0) / m_WavePlotHeight * (Points[i].Y - m_WavePlotY);
 
-                             if (StartY < 0 || Points[i].Y > m_WavePlotY + m_WavePlotHeight) StartY = 0;
 
-                             if (StartY > Canvas_Main.ActualHeight - 50 || Points[i].Y < m_WavePlotY) StartY = Canvas_Main.ActualHeight - 50;
 
-                             points.Add(new PointF((float)StartX, (float)StartY));
 
-                         }
 
-                         if (m_WavePlotMinX == double.MaxValue || m_WavePlotMinX > Points[i].X) m_WavePlotMinX = Points[i].X;
 
-                         if (m_WavePlotMaxX == double.MinValue || m_WavePlotMaxX < Points[i].X) m_WavePlotMaxX = Points[i].X;
 
-                         if (m_WavePlotMinY == double.MaxValue || m_WavePlotMinY > Points[i].Y) m_WavePlotMinY = Points[i].Y;
 
-                         if (m_WavePlotMaxY == double.MinValue || m_WavePlotMaxY < Points[i].Y) m_WavePlotMaxY = Points[i].Y;
 
-                     }
 
-                     if (points.Count > 1 && points.Where(_ => float.IsNaN(_.X) || float.IsNaN(_.Y)).ToList<PointF>().Count == 0) graphics.DrawLines(m_PenData, points.ToArray());
 
-                 }
 
-                 if (this.PointCollections != null && this.PointCollections.Count > 0)
 
-                 {
 
-                     for (int i = 0; i < this.PointCollections.Count; i++)
 
-                     {
 
-                         List<PointF> points = new List<PointF>();
 
-                         for (int j = 0; j < this.PointCollections[i].Count; j++)
 
-                         {
 
-                             if (this.PointCollections[i][j].X >= m_WavePlotX && this.PointCollections[i][j].X <= m_WavePlotX + m_WavePlotWidth)
 
-                             {
 
-                                 double StartX = m_StartDrawLineX + (Canvas_Main.ActualWidth - m_StartDrawLineX) / m_WavePlotWidth * (this.PointCollections[i][j].X - m_WavePlotX);
 
-                                 if (StartX < m_StartDrawLineX || this.PointCollections[i][j].X < m_WavePlotX) StartX = m_StartDrawLineX;
 
-                                 if (StartX > Canvas_Main.ActualWidth || this.PointCollections[i][j].X > m_WavePlotX + m_WavePlotWidth) StartX = Canvas_Main.ActualWidth;
 
-                                 double StartY = Canvas_Main.ActualHeight - 50 - (Canvas_Main.ActualHeight - 50.0) / m_WavePlotHeight * (this.PointCollections[i][j].Y - m_WavePlotY);
 
-                                 if (StartY < 0 || this.PointCollections[i][j].Y > m_WavePlotY + m_WavePlotHeight) StartY = 0;
 
-                                 if (StartY > Canvas_Main.ActualHeight - 50 || this.PointCollections[i][j].Y < m_WavePlotY) StartY = Canvas_Main.ActualHeight - 50;
 
-                                 points.Add(new PointF((float)StartX, (float)StartY));
 
-                             }
 
-                             if (m_WavePlotMinX == double.MaxValue || m_WavePlotMinX > this.PointCollections[i][j].X) m_WavePlotMinX = this.PointCollections[i][j].X;
 
-                             if (m_WavePlotMaxX == double.MinValue || m_WavePlotMaxX < this.PointCollections[i][j].X) m_WavePlotMaxX = this.PointCollections[i][j].X;
 
-                             if (m_WavePlotMinY == double.MaxValue || m_WavePlotMinY > this.PointCollections[i][j].Y) m_WavePlotMinY = this.PointCollections[i][j].Y;
 
-                             if (m_WavePlotMaxY == double.MinValue || m_WavePlotMaxY < this.PointCollections[i][j].Y) m_WavePlotMaxY = this.PointCollections[i][j].Y;
 
-                         }
 
-                         if (points.Count > 1 && points.Where(_ => float.IsNaN(_.X) || float.IsNaN(_.Y)).ToList<PointF>().Count == 0)
 
-                         {
 
-                             graphics.DrawLines(m_PenCollencteions[i % 10], points.ToArray());
 
-                         }
 
-                     }
 
-                 }
 
-                 if (YPoints.Count > 0)
 
-                 { 
 
-                     YPoints.ForEach(p => 
 
-                     {
 
-                         double StartX = m_StartDrawLineX + (Canvas_Main.ActualWidth - m_StartDrawLineX) / m_WavePlotWidth * (p.StartValue - m_WavePlotX);
 
-                         if (StartX < m_StartDrawLineX || p.StartValue < m_WavePlotX)
 
-                         {
 
-                             StartX = m_StartDrawLineX;
 
-                         }
 
-                         if (StartX > Canvas_Main.ActualWidth || p.StartValue > m_WavePlotX + m_WavePlotWidth)
 
-                         {
 
-                             StartX = Canvas_Main.ActualWidth;
 
-                         }
 
-                        
 
-                         graphics.DrawLine(Pens.Red, (float)StartX, (float)Canvas_Main.ActualHeight-50, (float)StartX,0);
 
-                         graphics.DrawString(p.Information, System.Drawing.SystemFonts.DefaultFont, System.Drawing.Brushes.Red, (float)StartX, (float)Canvas_Main.ActualHeight/6);
 
-                     });
 
-                 }
 
-                 //框选
 
-                 if (m_StartMouseMove && m_MouseMove)
 
-                 {
 
-                     if (m_StartPoint != null && m_EndPoint != null)
 
-                     {
 
-                         int x = m_StartPoint.X > m_EndPoint.X ? (int)m_EndPoint.X : (int)m_StartPoint.X;
 
-                         int y = m_StartPoint.Y > m_EndPoint.Y ? (int)m_EndPoint.Y : (int)m_StartPoint.Y;
 
-                         int width = (int)Math.Abs(m_EndPoint.X - m_StartPoint.X);
 
-                         int height = (int)Math.Abs(m_EndPoint.Y - m_StartPoint.Y);
 
-                         System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle(x, y, width, height);                    
 
-                         SolidBrush shadowBrush = new SolidBrush(System.Drawing.Color.FromArgb(100,100,100,100));
 
-                         graphics.FillRectangle(shadowBrush, rectangle);
 
-                         graphics.DrawRectangle(new System.Drawing.Pen (System.Drawing.Color.Transparent), rectangle);
 
-                     }
 
-                 }
 
-                 else
 
-                 {
 
-                     //拾取坐标
 
-                     if (m_MouseEnter && m_CurrentPoint != null)
 
-                     {
 
-                         double X = m_WavePlotX + (m_CurrentPoint.X - m_StartDrawLineX) / ((this.ActualWidth - m_StartDrawLineX) / m_WavePlotWidth);
 
-                         double Y = m_WavePlotY + (this.ActualHeight - 50 - m_CurrentPoint.Y) / ((this.ActualHeight - 50) / m_WavePlotHeight);
 
-                         if (this.PointCollections == null || this.PointCollections.Count <= 10)
 
-                         {
 
-                             graphics.DrawLine(m_PenBlue, new System.Drawing.PointF((float)m_StartDrawLineX, (float)m_CurrentPoint.Y), new PointF((float)Canvas_Main.ActualWidth, (float)m_CurrentPoint.Y));
 
-                             graphics.DrawLine(m_PenBlue, new System.Drawing.PointF((float)m_CurrentPoint.X, 0), new PointF((float)m_CurrentPoint.X, (float)Canvas_Main.ActualHeight - 50));
 
-                             //if (IsHorizontalDateTimeAxis)
 
-                             //{
 
-                             //    graphics.DrawString(string.Format("X={0};Y={1}", DateTime.FromOADate(X), Y.ToString("0.00")), System.Drawing.SystemFonts.DefaultFont, m_BrushXYText, new PointF((float)m_CurrentPoint.X + 10, (float)m_CurrentPoint.Y + 10));
 
-                             //}
 
-                             //else
 
-                             //{
 
-                             //    graphics.DrawString(string.Format("X={0};Y={1}", X.ToString("0.00"), Y.ToString("0.00")), System.Drawing.SystemFonts.DefaultFont, m_BrushXYText, new PointF((float)m_CurrentPoint.X + 10, (float)m_CurrentPoint.Y + 10));
 
-                             //}
 
-                         }
 
-                         //
 
-                         if (this.PlotDataPoints != null && this.PlotDataPoints.Count > 0)
 
-                         {
 
-                             if (X >= this.PlotDataPoints[0].X && X <= this.PlotDataPoints[this.PlotDataPoints.Count - 1].X)
 
-                             {
 
-                                 //int index = this.PlotDataX.IndexOf((int)Math.Round(X, 0));
 
-                                 var minDistance = this.PlotDataPoints.Min(x => Math.Abs(x.X - X));
 
-                                 var closest = this.PlotDataPoints.First(x => Math.Abs(Math.Abs(x.X - X) - minDistance) < 0.0001f);
 
-                                 int index = this.PlotDataPoints.IndexOf(closest);
 
-                                 if (index >= 0)
 
-                                 {
 
-                                     double StartX = m_StartDrawLineX + (Canvas_Main.ActualWidth - m_StartDrawLineX) / m_WavePlotWidth * (PlotDataPoints[index].X - m_WavePlotX);
 
-                                     if (StartX < m_StartDrawLineX || PlotDataPoints[index].X < m_WavePlotX) StartX = m_StartDrawLineX;
 
-                                     if (StartX > Canvas_Main.ActualWidth || PlotDataPoints[index].X > m_WavePlotX + m_WavePlotWidth) StartX = Canvas_Main.ActualWidth;
 
-                                     double StartY = Canvas_Main.ActualHeight - 50 - (Canvas_Main.ActualHeight - 50.0) / m_WavePlotHeight * (PlotDataPoints[index].Y - m_WavePlotY);
 
-                                     if (StartY < 0 || PlotDataPoints[index].Y > m_WavePlotY + m_WavePlotHeight) StartY = 0;
 
-                                     if (StartY > Canvas_Main.ActualHeight - 50 || PlotDataPoints[index].Y < m_WavePlotY) StartY = Canvas_Main.ActualHeight - 50;
 
-                                     if (!double.IsNaN(StartX) && !double.IsNaN(StartY))
 
-                                     {
 
-                                         System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle((int)StartX, (int)StartY, 5, 5);
 
-                                         graphics.FillRectangle(System.Drawing.Brushes.Blue, rectangle);
 
-                                         graphics.DrawEllipse(m_PenBlue, rectangle);
 
-                                         if (IsHorizontalDateTimeAxis)
 
-                                         {
 
-                                             graphics.DrawString(string.Format("X={0};Y={1}", DateTime.FromOADate(PlotDataPoints[index].X), PlotDataPoints[index].Y.ToString("0.00")), System.Drawing.SystemFonts.DefaultFont, m_BrushXYText, new PointF((float)StartX + 10, (float)StartY + 10));
 
-                                         }
 
-                                         else
 
-                                         {
 
-                                             graphics.DrawString(string.Format("X={0};Y={1}", PlotDataPoints[index].X.ToString("0.00"), PlotDataPoints[index].Y.ToString("0.00")), System.Drawing.SystemFonts.DefaultFont, m_BrushXYText, new PointF((float)StartX + 10, (float)StartY + 10));
 
-                                         }
 
-                                     }
 
-                                 }
 
-                             }
 
-                         }
 
-                         //
 
-                         if (this.PlotSDataPoints != null && this.PlotSDataPoints.Count > 0)
 
-                         {
 
-                             if (X >= this.PlotSDataPoints[0].X && X <= this.PlotSDataPoints[this.PlotSDataPoints.Count - 1].X)
 
-                             {
 
-                                 //int index = this.PlotSDataX.IndexOf((int)Math.Round(X, 0));
 
-                                 var minDistance = this.PlotSDataPoints.Min(x => Math.Abs(x.X - X));
 
-                                 var closest = this.PlotSDataPoints.First(x => Math.Abs(Math.Abs(x.X - X) - minDistance) < 0.0001f);
 
-                                 int index = this.PlotSDataPoints.IndexOf(closest);
 
-                                 if (index >= 0)
 
-                                 {
 
-                                     double StartX = m_StartDrawLineX + (Canvas_Main.ActualWidth - m_StartDrawLineX) / m_WavePlotWidth * (PlotSDataPoints[index].X - m_WavePlotX);
 
-                                     if (StartX < m_StartDrawLineX || PlotSDataPoints[index].X < m_WavePlotX) StartX = m_StartDrawLineX;
 
-                                     if (StartX > Canvas_Main.ActualWidth || PlotSDataPoints[index].X > m_WavePlotX + m_WavePlotWidth) StartX = Canvas_Main.ActualWidth;
 
-                                     double StartY = Canvas_Main.ActualHeight - 50 - (Canvas_Main.ActualHeight - 50.0) / m_WavePlotHeight * (PlotSDataPoints[index].Y - m_WavePlotY);
 
-                                     if (StartY < 0 || PlotSDataPoints[index].Y > m_WavePlotY + m_WavePlotHeight) StartY = 0;
 
-                                     if (StartY > Canvas_Main.ActualHeight - 50 || PlotSDataPoints[index].Y < m_WavePlotY) StartY = Canvas_Main.ActualHeight - 50;
 
-                                     if (!double.IsNaN(StartX) && !double.IsNaN(StartY))
 
-                                     {
 
-                                         System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle((int)StartX, (int)StartY, 5, 5);
 
-                                         graphics.FillRectangle(System.Drawing.Brushes.Blue, rectangle);
 
-                                         graphics.DrawEllipse(m_PenBlue, rectangle);
 
-                                         graphics.DrawString(string.Format("X={0};Y={1}", PlotSDataPoints[index].X.ToString("0.00"), PlotSDataPoints[index].Y.ToString("0.00")), System.Drawing.SystemFonts.DefaultFont, m_BrushXYText, new PointF((float)StartX + 10, (float)StartY + 10));
 
-                                     }
 
-                                 }
 
-                             }
 
-                         }
 
-                         //
 
-                         if (this.PlotASDataPoints != null && this.PlotASDataPoints.Count > 0)
 
-                         {
 
-                             if (X >= this.PlotASDataPoints[0].X && X <= this.PlotASDataPoints[this.PlotASDataPoints.Count - 1].X)
 
-                             {
 
-                                 //int index = this.PlotASDataX.IndexOf((int)Math.Round(X, 0));
 
-                                 var minDistance = this.PlotASDataPoints.Min(x => Math.Abs(x.X - X));
 
-                                 var closest = this.PlotASDataPoints.First(x => Math.Abs(x.X - X) == minDistance);
 
-                                 int index = this.PlotASDataPoints.IndexOf(closest);
 
-                                 if (index >= 0)
 
-                                 {
 
-                                     double StartX = m_StartDrawLineX + (Canvas_Main.ActualWidth - m_StartDrawLineX) / m_WavePlotWidth * (PlotASDataPoints[index].X - m_WavePlotX);
 
-                                     if (StartX < m_StartDrawLineX || PlotASDataPoints[index].X < m_WavePlotX) StartX = m_StartDrawLineX;
 
-                                     if (StartX > Canvas_Main.ActualWidth || PlotASDataPoints[index].X > m_WavePlotX + m_WavePlotWidth) StartX = Canvas_Main.ActualWidth;
 
-                                     double StartY = Canvas_Main.ActualHeight - 50 - (Canvas_Main.ActualHeight - 50.0) / m_WavePlotHeight * (PlotASDataPoints[index].Y - m_WavePlotY);
 
-                                     if (StartY < 0 || PlotASDataPoints[index].Y > m_WavePlotY + m_WavePlotHeight) StartY = 0;
 
-                                     if (StartY > Canvas_Main.ActualHeight - 50 || PlotASDataPoints[index].Y < m_WavePlotY) StartY = Canvas_Main.ActualHeight - 50;
 
-                                     if (!double.IsNaN(StartX) && !double.IsNaN(StartY))
 
-                                     {
 
-                                         System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle((int)StartX, (int)StartY, 5, 5);
 
-                                         graphics.FillRectangle(System.Drawing.Brushes.Blue, rectangle);
 
-                                         graphics.DrawEllipse(m_PenBlue, rectangle);
 
-                                         graphics.DrawString(string.Format("X={0};Y={1}", PlotASDataPoints[index].X.ToString("0.00"), PlotASDataPoints[index].Y.ToString("0.00")), System.Drawing.SystemFonts.DefaultFont, m_BrushXYText, new PointF((float)StartX + 10, (float)StartY + 10));
 
-                                     }
 
-                                 }
 
-                             }
 
-                         }
 
-                         //
 
-                         if (this.PointCollections != null && this.PointCollections.Count <= 10)
 
-                         {
 
-                             foreach (PointCollection point in this.PointCollections)
 
-                             {
 
-                                 //if (X >= point[0].X && X <= point[point.Count - 1].X)
 
-                                 {
 
-                                     //int index = this.PlotASDataX.IndexOf((int)Math.Round(X, 0));
 
-                                     var minDistance = point.Min(x => Math.Abs(x.X - X));
 
-                                     var closest = point.First(x => Math.Abs(x.X - X) == minDistance);
 
-                                     int index = point.IndexOf(closest);
 
-                                     if (index >= 0)
 
-                                     {
 
-                                         double StartX = m_StartDrawLineX + (Canvas_Main.ActualWidth - m_StartDrawLineX) / m_WavePlotWidth * (point[index].X - m_WavePlotX);
 
-                                         if (StartX < m_StartDrawLineX || point[index].X < m_WavePlotX) StartX = m_StartDrawLineX;
 
-                                         if (StartX > Canvas_Main.ActualWidth || point[index].X > m_WavePlotX + m_WavePlotWidth) StartX = Canvas_Main.ActualWidth;
 
-                                         double StartY = Canvas_Main.ActualHeight - 50 - (Canvas_Main.ActualHeight - 50.0) / m_WavePlotHeight * (point[index].Y - m_WavePlotY);
 
-                                         if (StartY < 0 || point[index].Y > m_WavePlotY + m_WavePlotHeight) StartY = 0;
 
-                                         if (StartY > Canvas_Main.ActualHeight - 50 || point[index].Y < m_WavePlotY) StartY = Canvas_Main.ActualHeight - 50;
 
-                                         if (!double.IsNaN(StartX) && !double.IsNaN(StartY))
 
-                                         {
 
-                                             System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle((int)StartX, (int)StartY, 5, 5);
 
-                                             graphics.FillRectangle(System.Drawing.Brushes.Blue, rectangle);
 
-                                             graphics.DrawEllipse(m_PenBlue, rectangle);
 
-                                             if (IsHorizontalDateTimeAxis)
 
-                                             {
 
-                                                 graphics.DrawString(string.Format("X={0};Y={1}", DateTime.FromOADate(point[index].X), point[index].Y.ToString("0.00")), new Font("Times New Roman", 15.0F), m_BrushXYText, new PointF((float)StartX + 10, (float)StartY + 10));
 
-                                             }
 
-                                             else
 
-                                             {
 
-                                                 graphics.DrawString(string.Format("X={0};Y={1}", point[index].X.ToString("0.00"), point[index].Y.ToString("0.00")),     new Font("Times New Roman", 15.0F),   m_BrushXYText, new PointF((float)StartX + 10, (float)StartY + 10));
 
-                                             }
 
-                                         }
 
-                                     }
 
-                                 }
 
-                             }
 
-                         }
 
-                     }
 
-                 }
 
-                 ImageBrush_BK.ImageSource = BitmapToBitmapImage(bitmap);
 
-             }
 
-             this.InvalidateVisual();
 
-         }
 
-         #endregion Private Draw
 
-         #region Private
 
-         private void Canvas_Main_SizeChanged(object sender, SizeChangedEventArgs e)
 
-         {
 
-             GraphicDraw();
 
-         }
 
-         private void Canvas_Main_MouseWheel(object sender, MouseWheelEventArgs e)
 
-         {
 
-             double factor = e.Delta < 0 ? 1.2 : 1 / 1.2;
 
-             if (IsVerticalNavigationEnabled)
 
-             {
 
-                 double Min = m_WavePlotY;
 
-                 double Max = m_WavePlotY + m_WavePlotHeight;
 
-                 double delta = (Max - Min) / 2;
 
-                 double center = (Max + Min) / 2;
 
-                 Min = center - delta * factor;
 
-                 Max = center + delta * factor;
 
-                 m_WavePlotY = Min;
 
-                 m_WavePlotHeight = Max - Min;
 
-             }
 
-             if (IsHorizontalNavigationEnabled)
 
-             {
 
-                 double Min = m_WavePlotX;
 
-                 double Max = m_WavePlotX + m_WavePlotWidth;
 
-                 double delta = (Max - Min) / 2;
 
-                 double center = (Max + Min) / 2;
 
-                 Min = center - delta * factor;
 
-                 Max = center + delta * factor;
 
-                 m_WavePlotX = Min;
 
-                 m_WavePlotWidth = Max - Min;
 
-             }
 
-             GraphicDraw();
 
-         }
 
-         private void Canvas_Main_MouseLeftButtonDown(object sender, MouseButtonEventArgs e)
 
-         {
 
-             this.Cursor = Cursors.Hand;
 
-             if (e.ClickCount == 2)
 
-             {
 
-                 FitControl();
 
-             }
 
-             else
 
-             {
 
-                 m_StartPoint = Mouse.GetPosition(e.Source as FrameworkElement);
 
-                 if (e.LeftButton == MouseButtonState.Pressed)
 
-                 {
 
-                     m_StartMouseMove = true;
 
-                 }//开始绘制矩形
 
-             }
 
-         }
 
-         private void Canvas_Main_MouseMove(object sender, MouseEventArgs e)
 
-         {
 
-             m_EndPoint = Mouse.GetPosition(e.Source as FrameworkElement);
 
-             m_CurrentPoint = Mouse.GetPosition(e.Source as FrameworkElement);
 
-             if ((Keyboard.Modifiers == ModifierKeys.Control || m_MouseMove) && m_StartMouseMove)
 
-             {
 
-                 m_MouseMove = true;
 
-                 GraphicDraw();
 
-             }//移动矩形位置
 
-             else if (m_StartMouseMove)
 
-             {
 
-                 m_WavePlotX = m_WavePlotX - (m_EndPoint.X - m_StartPoint.X) / (this.ActualWidth - 50) * m_WavePlotWidth;
 
-                 m_WavePlotY = m_WavePlotY + (m_EndPoint.Y - m_StartPoint.Y) / (this.ActualHeight - 50) * m_WavePlotHeight;
 
-                 m_StartPoint = m_EndPoint;
 
-                 GraphicDraw();
 
-             }
 
-             else if (this.PointCollections == null || this.PointCollections.Count <= 10)
 
-             {
 
-                 GraphicDraw();
 
-             }
 
-         }
 
-         private void Canvas_Main_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
 
-         {
 
-             this.Cursor = Cursors.Arrow;
 
-             if (m_StartMouseMove && m_MouseMove && e.LeftButton == MouseButtonState.Released)
 
-             {
 
-                 m_StartMouseMove = false;
 
-                 m_MouseMove = false;
 
-                 if (m_StartPoint.X == m_EndPoint.X || m_StartPoint.Y == m_EndPoint.Y) return;
 
-                 double x = m_StartPoint.X > m_EndPoint.X ? m_EndPoint.X : m_StartPoint.X;
 
-                 double y = m_StartPoint.Y < m_EndPoint.Y ? m_EndPoint.Y : m_StartPoint.Y;
 
-                 double width = Math.Abs(m_EndPoint.X - m_StartPoint.X);
 
-                 double height = Math.Abs(m_EndPoint.Y - m_StartPoint.Y);
 
-                 //设置坐标轴起始位置
 
-                 this.m_WavePlotX = this.m_WavePlotX + (x - m_StartDrawLineX) / ((this.ActualWidth - m_StartDrawLineX) / this.m_WavePlotWidth);
 
-                 this.m_WavePlotY = this.m_WavePlotY + (this.ActualHeight - 50 - y) / ((this.ActualHeight - 50) / this.m_WavePlotHeight);
 
-                 this.m_WavePlotWidth = this.m_WavePlotWidth * (width / (this.ActualWidth - m_StartDrawLineX));
 
-                 this.m_WavePlotHeight = this.m_WavePlotHeight * (height / (this.ActualHeight - 50));
 
-                 GraphicDraw();
 
-             }//结束绘制矩形
 
-             m_StartMouseMove = false;
 
-             m_MouseMove = false;
 
-         }
 
-         private void Canvas_Main_MouseEnter(object sender, MouseEventArgs e)
 
-         {
 
-             if (this.PointCollections == null || this.PointCollections.Count <= 10)
 
-             {
 
-                 m_MouseEnter = true;
 
-             } 
 
-         }
 
-         private void Canvas_Main_MouseLeave(object sender, MouseEventArgs e)
 
-         {
 
-             if (this.PointCollections == null || this.PointCollections.Count <= 10) m_MouseEnter = false;
 
-             GraphicDraw();
 
-         }
 
-         private void Canvas_Main_MouseRightButtonUp(object sender, MouseButtonEventArgs e)
 
-         {
 
-             m_WavePlotX = WavePlotOriginX;
 
-             m_WavePlotY = WavePlotOriginY;
 
-             m_WavePlotWidth = WavePlotOriginWidth;
 
-             m_WavePlotHeight = WavePlotOriginHeight;
 
-             ResetControl();
 
-         }
 
-         /// <summary>
 
-         /// 获取坐标间隔
 
-         /// </summary>
 
-         /// <returns></returns>
 
-         private void GetIntervalValue(double min, double max, out int IntervalValue, out int expCount)
 
-         {
 
-             IntervalValue = 0;
 
-             expCount = 0;
 
-             double ActualValue = Math.Abs(max - min);
 
-             if (ActualValue < 1)
 
-             {
 
-                 while (ActualValue < 1)
 
-                 {
 
-                     ActualValue *= 10;
 
-                     expCount -= 1;
 
-                 }
 
-             }
 
-             else
 
-             {
 
-                 while (ActualValue >= 10)
 
-                 {
 
-                     ActualValue /= 10;
 
-                     expCount += 1;
 
-                 }
 
-             }
 
-             if (ActualValue <= 1.2)
 
-             {
 
-                 IntervalValue = 1;
 
-                 expCount -= 1;
 
-             }
 
-             else if (ActualValue <= 3)
 
-             {
 
-                 IntervalValue = 2;
 
-                 expCount -= 1;
 
-             }
 
-             else if (ActualValue <= 5)
 
-             {
 
-                 IntervalValue = 5;
 
-                 expCount -= 1;
 
-             }
 
-             else
 
-             {
 
-                 IntervalValue = 1;
 
-             }
 
-         }
 
-         /// <summary>
 
-         /// 字符串值中包含E等科学计数法
 
-         /// </summary>
 
-         /// <param name="strData"></param>
 
-         /// <returns></returns>
 
-         private Decimal ChangeDataToD(string strData)
 
-         {
 
-             Decimal dData = 0.0M;
 
-             if (strData.ToString().Contains("E"))
 
-             {
 
-                 dData = Decimal.Parse(strData, System.Globalization.NumberStyles.Float);
 
-             }
 
-             else
 
-             {
 
-                 dData = Decimal.Parse(strData);
 
-             }
 
-             return dData;
 
-         }
 
-         /// <summary>
 
-         /// Bitmap --> BitmapImage
 
-         /// </summary>
 
-         /// <param name="bitmap"></param>
 
-         /// <returns></returns>
 
-         private BitmapImage BitmapToBitmapImage(Bitmap bitmap)
 
-         {
 
-             using (MemoryStream stream = new MemoryStream())
 
-             {
 
-                 bitmap.Save(stream, ImageFormat.Png); // 坑点:格式选Bmp时,不带透明度
 
-                 stream.Position = 0;
 
-                 BitmapImage result = new BitmapImage();
 
-                 result.BeginInit();
 
-                 // According to MSDN, "The default OnDemand cache option retains access to the stream until the image is needed."
 
-                 // Force the bitmap to load right now so we can dispose the stream.
 
-                 result.CacheOption = BitmapCacheOption.OnLoad;
 
-                 result.StreamSource = stream;
 
-                 result.EndInit();
 
-                 result.Freeze();
 
-                 return result;
 
-             }
 
-         }
 
-         #endregion Private
 
-     }
 
- }
 
 
  |