Esempio n. 1
0
        private static void UnitXYPropertyChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            MValueFunct2DBase instance = d as MValueFunct2DBase;

            if (instance == null)
            {
                return;
            }
            instance.UpdateUnitLabels();
        }
Esempio n. 2
0
        protected void DrawText(double _x, double _y, int _tag, string _content, FunctionEditState _state = FunctionEditState.REGULAR)
        {
            // scale input for drawing on the canvas
            double x_scaled = (_x - this.xs[0]) * this.fact_x;
            double y_scaled = this.canvas.Height - (_y - this.ys[0]) * this.fact_y;

            TextBlock tb = new TextBlock();

            tb.Height = 20;
            tb.Width  = 60;
            tb.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            tb.VerticalAlignment   = System.Windows.VerticalAlignment.Top;
            tb.Margin     = new Thickness(x_scaled - 60, y_scaled - 20, 0, 0);
            tb.Foreground = new SolidColorBrush(MValueFunct2DBase.SetColorAccToState(_state));
            tb.Tag        = _tag;
            tb.Text       = _content;

            this.canvas.Children.Add(tb);
        }
Esempio n. 3
0
        protected void DrawPoint(double _x, double _y, int _tag, FunctionEditState _state = FunctionEditState.REGULAR)
        {
            // scale input for drawing on the canvas
            double x_scaled = (_x - this.xs[0]) * this.fact_x;
            double y_scaled = this.canvas.Height - (_y - this.ys[0]) * this.fact_y;

            Rectangle rect = new Rectangle();

            rect.Height = 6;
            rect.Width  = 6;
            rect.HorizontalAlignment = System.Windows.HorizontalAlignment.Left;
            rect.VerticalAlignment   = System.Windows.VerticalAlignment.Top;
            rect.Margin          = new Thickness(x_scaled - 3, y_scaled - 3, 0, 0);
            rect.Stroke          = new SolidColorBrush(MValueFunct2DBase.SetColorAccToState(_state));
            rect.StrokeThickness = 2;
            rect.Tag             = _tag;
            rect.ToolTip         = "(" + _x.ToString("F2", MValueFunct2DBase.FORMATTER) + " " +
                                   _y.ToString("F2", MValueFunct2DBase.FORMATTER) + ")";
            this.canvas.Children.Add(rect);
        }
Esempio n. 4
0
        protected void DrawLine(double _x1, double _y1, double _x2, double _y2, Point _tag, FunctionEditState _state = FunctionEditState.REGULAR)
        {
            // scale input for drawing on the canvas
            double x1_scaled = (_x1 - this.xs[0]) * this.fact_x;
            double y1_scaled = this.canvas.Height - (_y1 - this.ys[0]) * this.fact_y;
            double x2_scaled = (_x2 - this.xs[0]) * this.fact_x;
            double y2_scaled = this.canvas.Height - (_y2 - this.ys[0]) * this.fact_y;

            Line li = new Line();

            li.X1              = x1_scaled;
            li.Y1              = y1_scaled;
            li.X2              = x2_scaled;
            li.Y2              = y2_scaled;
            li.Stroke          = new SolidColorBrush(MValueFunct2DBase.SetColorAccToState(_state));
            li.StrokeThickness = 2;
            li.Tag             = _tag;
            li.SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased);
            li.MouseUp += line_MouseUp;
            this.canvas.Children.Add(li);
        }