コード例 #1
0
 public void PlotMouseDown(LinearBarSeries lb, MapStatistics ms, OxyMouseDownEventArgs e)
 {
     if (lb.Points.Count != 0)
     {
         DataPoint dd = new DataPoint(lb.InverseTransform(e.Position).X, lb.InverseTransform(e.Position).Y);
         ms._startPoint1 = dd;
     }
 }
コード例 #2
0
        public void PlotMouseMove(LinearBarSeries lb, MapStatistics ms, OxyMouseEventArgs e)
        {
            if (lb.Points.Count != 0)
            {
                ms._endPoint1 = lb.InverseTransform(e.Position);
                if (ms._startPoint1.X != 0 || ms._startPoint1.Y != 0)
                {
                    ms._pm.Annotations.Clear();

                    var rectangle = new PolygonAnnotation();
                    rectangle.Layer           = AnnotationLayer.BelowAxes;
                    rectangle.StrokeThickness = 0.5;
                    rectangle.Stroke          = OxyColors.Red;
                    rectangle.Fill            = OxyColors.Transparent;
                    rectangle.LineStyle       = OxyPlot.LineStyle.Dot;

                    rectangle.Points.Add(new DataPoint(ms._startPoint1.X, ms._startPoint1.Y));
                    rectangle.Points.Add(new DataPoint(ms._endPoint1.X, ms._startPoint1.Y));
                    rectangle.Points.Add(new DataPoint(ms._endPoint1.X, ms._endPoint1.Y));
                    rectangle.Points.Add(new DataPoint(ms._startPoint1.X, ms._endPoint1.Y));

                    ms._pm.Annotations.Add(rectangle as Annotation);
                    ms._pm.InvalidatePlot(true);
                }
            }
        }