Ejemplo n.º 1
1
        public static void Draw(Canvas canvas, List<LinePoint> points, Brush stroke, bool clear = true)
        {
            if (clear)
            {
                canvas.Children.Clear();
            }

            PathFigureCollection myPathFigureCollection = new PathFigureCollection();
            PathGeometry myPathGeometry = new PathGeometry();

            foreach (LinePoint p in points)
            {
                PathFigure myPathFigure = new PathFigure();
                myPathFigure.StartPoint = p.StartPoint;

                LineSegment myLineSegment = new LineSegment();
                myLineSegment.Point = p.EndPoint;

                PathSegmentCollection myPathSegmentCollection = new PathSegmentCollection();
                myPathSegmentCollection.Add(myLineSegment);

                myPathFigure.Segments = myPathSegmentCollection;

                myPathFigureCollection.Add(myPathFigure);
            }

            myPathGeometry.Figures = myPathFigureCollection;
            Path myPath = new Path();
            myPath.Stroke = stroke == null ? Brushes.Black : stroke;
            myPath.StrokeThickness = 1;
            myPath.Data = myPathGeometry;

            canvas.Children.Add(myPath);
        }
Ejemplo n.º 2
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 14 "..\..\..\..\OtherWindows\MainMenu.xaml"
                ((System.Windows.Controls.Grid)(target)).MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.Grid_MouseLeftButtonDown);

            #line default
            #line hidden
                return;

            case 2:
                this.CloseMainMenu = ((DesktopClock.Custom.CustomButton)(target));
                return;

            case 3:
                this.SizeThumbScope = ((System.Windows.Shapes.Path)(target));
                return;

            case 4:
                this.SizeThumb = ((System.Windows.Controls.Primitives.Thumb)(target));

            #line 27 "..\..\..\..\OtherWindows\MainMenu.xaml"
                this.SizeThumb.DragDelta += new System.Windows.Controls.Primitives.DragDeltaEventHandler(this.SizeThumb_DragDelta);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 3
0
        private static XamlShapes.Shape CreateSymbolFromVectorStyle(VectorStyle style, double opacity = 1,
                                                                    SymbolType symbolType             = SymbolType.Ellipse)
        {
            // The SL StrokeThickness default is 1 which causes blurry bitmaps
            var path = new XamlShapes.Path
            {
                StrokeThickness = 0,
                Fill            = ToXaml(style.Fill)
            };

            if (style.Outline != null)
            {
                path.Stroke          = new XamlMedia.SolidColorBrush(style.Outline.Color.ToXaml());
                path.StrokeThickness = style.Outline.Width;
                path.StrokeDashArray = style.Outline.PenStyle.ToXaml();
            }

            if (symbolType == SymbolType.Ellipse)
            {
                path.Data = CreateEllipse(SymbolStyle.DefaultWidth, SymbolStyle.DefaultHeight);
            }
            else
            {
                path.Data = CreateRectangle(SymbolStyle.DefaultWidth, SymbolStyle.DefaultHeight);
            }

            path.Opacity = opacity;

            return(path);
        }
Ejemplo n.º 4
0
        //to be modified

        //constructor
        public OvLine(Canvas canvas, ITextSnapshotLine itv, float bzCurvArea, OvCollection parent)
        {
            _bzCurvArea = bzCurvArea;

            lnNumber = itv.LineNumber;
            lnStart = 0.0f;
            lnTextStart = (float)Find1stChar(itv);
            //if (lnNumber == 65) System.Diagnostics.Trace.WriteLine("%%%                 REGEX: " + lnTextStart ); 
            lnEnd = (float)itv.Length;
            lnHeight = 1.0f;
            lnLength = itv.Length;
            lnColor = new System.Windows.Media.Color();                    //get the color of the textview
            lnFocus = false;

            myCanvas = canvas;
            myPath = new Path();
            myParent = parent;

            IsSeleted = false;
            

            this.myPath.MouseEnter += new System.Windows.Input.MouseEventHandler(myPath_MouseEnter);
            this.myPath.MouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(myPath_MouseLeftButtonDown);
            this.myPath.MouseLeave += new System.Windows.Input.MouseEventHandler(myPath_MouseLeave);

            
        }
Ejemplo n.º 5
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.btnSpeak = ((System.Windows.Controls.Button)(target));
                return;

            case 2:
                this.btnHear = ((System.Windows.Controls.Button)(target));
                return;

            case 3:
                this.btnThink = ((System.Windows.Controls.Button)(target));
                return;

            case 4:
                this.btnScenarioTest = ((System.Windows.Controls.Button)(target));

            #line 65 "..\..\MainWindow.xaml"
                this.btnScenarioTest.Click += new System.Windows.RoutedEventHandler(this.btnScenarioTest_Click);

            #line default
            #line hidden
                return;

            case 5:
                this.txtWhatHeard = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 6:
                this.thoughtCloud = ((System.Windows.Controls.Image)(target));
                return;

            case 7:
                this.leftEye = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 8:
                this.rightEye = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 9:
                this.leftEar = ((System.Windows.Shapes.Path)(target));
                return;

            case 10:
                this.rightEar = ((System.Windows.Shapes.Path)(target));
                return;

            case 11:
                this.smileyPath = ((System.Windows.Shapes.Path)(target));
                return;

            case 12:
                this.voiceEllipse = ((System.Windows.Shapes.Ellipse)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 6
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.vbLoading = ((System.Windows.Controls.Viewbox)(target));
                return;

            case 2:
                this.cnvLoading = ((System.Windows.Controls.Canvas)(target));
                return;

            case 3:
                this.Path_40 = ((System.Windows.Shapes.Path)(target));
                return;

            case 4:
                this.Path_41 = ((System.Windows.Shapes.Path)(target));
                return;

            case 5:
                this.Path_42 = ((System.Windows.Shapes.Path)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 7
0
Archivo: Train.cs Proyecto: M0N3/Subway
 internal void Stop(Canvas field, Subway subway)
 {
     pathAnimationStoryboard.Children.Clear();
     field.Children.Remove(trainPath);
     RectangleGeometry rc = trainPath.Data as RectangleGeometry;
     trainPath.RenderTransform = null;
     travelTime = 0;
     timeOnStation = 3;
     Start = false;
     onStation = false;
     leftStation = false;
     numOfPassage = passage;
     currStationInd = 0;
     id = 0;
     Back = false;
     away = false;
     if (subway.GetRailways.ElementAt(lineNumber).GetStations.Count > 1)
     {
         if (subway.GetRailways.ElementAt(lineNumber).GetStations.ElementAt(0) != null)
         {
             Station st = subway.GetRailways.ElementAt(lineNumber).GetStations.ElementAt(0);
             rc.Rect = new Rect(st.Coordinate.X - 15, st.Coordinate.Y - 15, 30, 30);
         }
         else
         {
             trainPath = null;
         }
     }
 }
Ejemplo n.º 8
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.Window = ((Wpfsearchlight.MainWindow)(target));
                return;

            case 2:
                this.LayoutRoot = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:
                this.exit = ((System.Windows.Controls.Button)(target));

            #line 33 "..\..\MainWindow.xaml"
                this.exit.Click += new System.Windows.RoutedEventHandler(this.exit_Click);

            #line default
            #line hidden
                return;

            case 4:
                this.path = ((System.Windows.Shapes.Path)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 9
0
        public WpfArc(IArc arc)
        {
            _xarc = arc;

            _fillBrush = new SolidColorBrush(_xarc.Fill.ToNativeColor());
            _fillBrush.Freeze();
            _strokeBrush = new SolidColorBrush(_xarc.Stroke.ToNativeColor());
            _strokeBrush.Freeze();

            _path = new Path();
            _path.Tag = this;
            _path.Fill = _fillBrush;
            _path.Stroke = _strokeBrush;
            _path.StrokeThickness = arc.StrokeThickness;
            _pg = new PathGeometry();
            _pf = new PathFigure();
            _pf.IsFilled = arc.IsFilled;
            _pf.IsClosed = arc.IsClosed;
            _start = new Point();
            _as = new ArcSegment();
            SetArcSegment(_as, arc, out _start);
            _pf.StartPoint = _start;
            _pf.Segments.Add(_as);
            _pg.Figures.Add(_pf);
            _path.Data = _pg;

            Native = _path;
        }
Ejemplo n.º 10
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/WPCandle;component/IndividualCandleControl.xaml", System.UriKind.Relative));
     this.userControl           = ((System.Windows.Controls.UserControl)(this.FindName("userControl")));
     this.SlowFlickerStoryboard = ((System.Windows.Media.Animation.Storyboard)(this.FindName("SlowFlickerStoryboard")));
     this.BurningStoryboard     = ((System.Windows.Media.Animation.Storyboard)(this.FindName("BurningStoryboard")));
     this.SideBobStoryboard     = ((System.Windows.Media.Animation.Storyboard)(this.FindName("SideBobStoryboard")));
     this.SideBobStoryboard2    = ((System.Windows.Media.Animation.Storyboard)(this.FindName("SideBobStoryboard2")));
     this.LayoutRoot            = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.VisualStateGroup      = ((System.Windows.VisualStateGroup)(this.FindName("VisualStateGroup")));
     this.WhiteVisualState      = ((System.Windows.VisualState)(this.FindName("WhiteVisualState")));
     this.BlueVisualState       = ((System.Windows.VisualState)(this.FindName("BlueVisualState")));
     this.FuchsiaVisualState    = ((System.Windows.VisualState)(this.FindName("FuchsiaVisualState")));
     this.OrangeVisualState     = ((System.Windows.VisualState)(this.FindName("OrangeVisualState")));
     this.GreenVisualState      = ((System.Windows.VisualState)(this.FindName("GreenVisualState")));
     this.PurpleVisualState     = ((System.Windows.VisualState)(this.FindName("PurpleVisualState")));
     this.BlackVisualState      = ((System.Windows.VisualState)(this.FindName("BlackVisualState")));
     this.RedVisualState        = ((System.Windows.VisualState)(this.FindName("RedVisualState")));
     this.ContentPanel          = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel")));
     this.Candle = ((System.Windows.Controls.Grid)(this.FindName("Candle")));
     this.FlameContainerRotation = ((System.Windows.Controls.Grid)(this.FindName("FlameContainerRotation")));
     this.FlameRotationCT        = ((System.Windows.Media.CompositeTransform)(this.FindName("FlameRotationCT")));
     this.HalosGridRotation      = ((System.Windows.Controls.Grid)(this.FindName("HalosGridRotation")));
     this.grid             = ((System.Windows.Controls.Grid)(this.FindName("grid")));
     this.HaloGeneral      = ((System.Windows.Shapes.Ellipse)(this.FindName("HaloGeneral")));
     this.Halo             = ((System.Windows.Shapes.Ellipse)(this.FindName("Halo")));
     this.FlameGrid        = ((System.Windows.Controls.Grid)(this.FindName("FlameGrid")));
     this.BitmapFlame      = ((System.Windows.Controls.Grid)(this.FindName("BitmapFlame")));
     this.ellipse          = ((System.Windows.Shapes.Ellipse)(this.FindName("ellipse")));
     this.BottomShadowGrid = ((System.Windows.Controls.Grid)(this.FindName("BottomShadowGrid")));
     this.BottomShadow     = ((System.Windows.Shapes.Ellipse)(this.FindName("BottomShadow")));
     this.BottomGrid       = ((System.Windows.Controls.Grid)(this.FindName("BottomGrid")));
     this.Bottom           = ((System.Windows.Shapes.Ellipse)(this.FindName("Bottom")));
     this.BodyGrid         = ((System.Windows.Controls.Grid)(this.FindName("BodyGrid")));
     this.Body             = ((System.Windows.Shapes.Rectangle)(this.FindName("Body")));
     this.GlowsGrid        = ((System.Windows.Controls.Grid)(this.FindName("GlowsGrid")));
     this.CandleHaloGrid   = ((System.Windows.Controls.Grid)(this.FindName("CandleHaloGrid")));
     this.CandleHaloGlow   = ((System.Windows.Shapes.Rectangle)(this.FindName("CandleHaloGlow")));
     this.CandleWickZone   = ((System.Windows.Shapes.Ellipse)(this.FindName("CandleWickZone")));
     this.MecheGrid        = ((System.Windows.Controls.Grid)(this.FindName("MecheGrid")));
     this.OrnamentsGrid    = ((System.Windows.Controls.Grid)(this.FindName("OrnamentsGrid")));
     this.Ornaments        = ((System.Windows.Controls.Grid)(this.FindName("Ornaments")));
     this.path             = ((System.Windows.Shapes.Path)(this.FindName("path")));
     this.path1            = ((System.Windows.Shapes.Path)(this.FindName("path1")));
     this.path2            = ((System.Windows.Shapes.Path)(this.FindName("path2")));
     this.path3            = ((System.Windows.Shapes.Path)(this.FindName("path3")));
     this.path4            = ((System.Windows.Shapes.Path)(this.FindName("path4")));
     this.path5            = ((System.Windows.Shapes.Path)(this.FindName("path5")));
     this.path6            = ((System.Windows.Shapes.Path)(this.FindName("path6")));
     this.path7            = ((System.Windows.Shapes.Path)(this.FindName("path7")));
     this.path8            = ((System.Windows.Shapes.Path)(this.FindName("path8")));
     this.path9            = ((System.Windows.Shapes.Path)(this.FindName("path9")));
     this.path10           = ((System.Windows.Shapes.Path)(this.FindName("path10")));
     this.path11           = ((System.Windows.Shapes.Path)(this.FindName("path11")));
 }
Ejemplo n.º 11
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/ResourceFramework;component/UserControls/Defences/Board.xaml", System.UriKind.Relative));
     this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.vbBoard    = ((System.Windows.Controls.Viewbox)(this.FindName("vbBoard")));
     this.Path_2     = ((System.Windows.Shapes.Path)(this.FindName("Path_2")));
     this.Path_3     = ((System.Windows.Shapes.Path)(this.FindName("Path_3")));
     this.Path_4     = ((System.Windows.Shapes.Path)(this.FindName("Path_4")));
     this.Group      = ((System.Windows.Controls.Viewbox)(this.FindName("Group")));
     this.Group_5    = ((System.Windows.Controls.Viewbox)(this.FindName("Group_5")));
     this.Group_8    = ((System.Windows.Controls.Viewbox)(this.FindName("Group_8")));
     this.Group_11   = ((System.Windows.Controls.Viewbox)(this.FindName("Group_11")));
     this.Path_14    = ((System.Windows.Shapes.Path)(this.FindName("Path_14")));
     this.Path_15    = ((System.Windows.Shapes.Path)(this.FindName("Path_15")));
     this.Path_16    = ((System.Windows.Shapes.Path)(this.FindName("Path_16")));
     this.Path_17    = ((System.Windows.Shapes.Path)(this.FindName("Path_17")));
     this.Path_18    = ((System.Windows.Shapes.Path)(this.FindName("Path_18")));
     this.Path_19    = ((System.Windows.Shapes.Path)(this.FindName("Path_19")));
     this.Path_20    = ((System.Windows.Shapes.Path)(this.FindName("Path_20")));
     this.Path_21    = ((System.Windows.Shapes.Path)(this.FindName("Path_21")));
     this.Path_22    = ((System.Windows.Shapes.Path)(this.FindName("Path_22")));
     this.Group_23   = ((System.Windows.Controls.Viewbox)(this.FindName("Group_23")));
     this.Group_26   = ((System.Windows.Controls.Viewbox)(this.FindName("Group_26")));
     this.Path_29    = ((System.Windows.Shapes.Path)(this.FindName("Path_29")));
     this.Group_30   = ((System.Windows.Controls.Viewbox)(this.FindName("Group_30")));
     this.Group_33   = ((System.Windows.Controls.Viewbox)(this.FindName("Group_33")));
     this.Group_36   = ((System.Windows.Controls.Viewbox)(this.FindName("Group_36")));
 }
        private void DrawPath(IEnumerable<Vector2> path)
        {
            if (!path.Any())
                throw new ArgumentException("Path cannot be empty.");

            var figure = new PathFigure();

            var start = path.First();
            figure.StartPoint = PointFromVector(start);

            foreach (var vector in path.Skip(1))
            {
                var point = PointFromVector(vector);
                figure.Segments.Add(new LineSegment(point, true));
            }

            var geometry = new PathGeometry();
            geometry.Figures.Add(figure);

            var pathImage = new Path()
            {
                Stroke = Brushes.Black,
                StrokeThickness = 3,
                Data = geometry
            };

            mainCanvas.Children.Add(pathImage);
        }
Ejemplo n.º 13
0
 public static Tuple<Path, PathFigure, ArcSegment> CreateArcShape()
 {
     var arcSegment = new ArcSegment()
     {
         SweepDirection = SweepDirection.Counterclockwise,
         RotationAngle = 0
     };
     var figure = new PathFigure()
     {
         IsClosed = false,
         IsFilled = false,
         Segments = new PathSegmentCollection()
         {
             arcSegment
         }
     };
     var path = new Path()
     {
         Data = new PathGeometry()
         {
             Figures = new PathFigureCollection()
             {
                 figure
             }
         },
         Stroke = new SolidColorBrush(Colors.Black),
         StrokeThickness = 1
     };
     return Tuple.Create(path, figure, arcSegment);
 }
Ejemplo n.º 14
0
        private static XamlShapes.Shape CreateSymbolFromVectorStyle(VectorStyle style, double opacity = 1, SymbolType symbolType = SymbolType.Ellipse, double width = SymbolStyle.DefaultWidth, double height = SymbolStyle.DefaultHeight)
        {
            var path = new XamlShapes.Path { StrokeThickness = 0 };  //The SL StrokeThickness default is 1 which causes blurry bitmaps

            if (style.Fill != null && (style.Fill.Color != null || style.Fill.BitmapId != -1))
                path.Fill = style.Fill.ToXaml();
            else
                path.Fill = new XamlMedia.SolidColorBrush(XamlColors.Transparent);

            if (style.Outline != null)
            {
                path.Stroke = new XamlMedia.SolidColorBrush(style.Outline.Color.ToXaml());
                path.StrokeThickness = style.Outline.Width;
                path.StrokeDashArray = style.Outline.PenStyle.ToXaml();
            }

            if (symbolType == SymbolType.Ellipse)
                path.Data = CreateEllipse(width, height);
            else
                path.Data = CreateRectangle(width, height);

            path.Opacity = opacity;

            return path;
        }
Ejemplo n.º 15
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/WebControl;component/Controls/HMICamera.xaml", System.UriKind.Relative));
     this.tbToolTip           = ((System.Windows.Controls.TextBlock)(this.FindName("tbToolTip")));
     this.MouseStateGroup     = ((System.Windows.VisualStateGroup)(this.FindName("MouseStateGroup")));
     this.ControlMouseEnter   = ((System.Windows.VisualState)(this.FindName("ControlMouseEnter")));
     this.ControlMouseLeave   = ((System.Windows.VisualState)(this.FindName("ControlMouseLeave")));
     this.ValueStateGroup     = ((System.Windows.VisualStateGroup)(this.FindName("ValueStateGroup")));
     this.ControlValueON      = ((System.Windows.VisualState)(this.FindName("ControlValueON")));
     this.ControlValueOFF     = ((System.Windows.VisualState)(this.FindName("ControlValueOFF")));
     this.ControlValueUnknown = ((System.Windows.VisualState)(this.FindName("ControlValueUnknown")));
     this.ActualStateGroup    = ((System.Windows.VisualStateGroup)(this.FindName("ActualStateGroup")));
     this.ControlActualTrue   = ((System.Windows.VisualState)(this.FindName("ControlActualTrue")));
     this.ControlActualFalse  = ((System.Windows.VisualState)(this.FindName("ControlActualFalse")));
     this.path2     = ((System.Windows.Shapes.Path)(this.FindName("path2")));
     this.path3     = ((System.Windows.Shapes.Path)(this.FindName("path3")));
     this.tbUnknown = ((System.Windows.Controls.TextBlock)(this.FindName("tbUnknown")));
     this.vwWarning = ((System.Windows.Controls.Viewbox)(this.FindName("vwWarning")));
     this.recMouse  = ((System.Windows.Shapes.Rectangle)(this.FindName("recMouse")));
 }
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.UserControl = ((InterfazWPF.EspacioSeleccionado)(target));
                return;

            case 2:
                this.LayoutRoot = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:
                this.trianguloIzquierdo = ((System.Windows.Shapes.Path)(target));
                return;

            case 4:
                this.trianguloDerecho = ((System.Windows.Shapes.Path)(target));
                return;

            case 5:
                this.rectanguloFondo = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 6:
                this.txt_nombreEspacio = ((System.Windows.Controls.TextBlock)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 17
0
 /// <summary>
 /// 页面加载
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void Page_Loaded(object sender, RoutedEventArgs e)
 {
     IsVirtualMark = new SolidColorBrush(Properties.Settings.Default.MarkVirtualColor);
     NotVirtualMark = new SolidColorBrush(Properties.Settings.Default.MarkNotColor);
     MarkDiameter = Properties.Settings.Default.MarkDiameter;
     RouteColor = new SolidColorBrush(Properties.Settings.Default.RouteColor);
     EVirtualMark.Fill = IsVirtualMark;
     ENotVirtualMark.Fill = NotVirtualMark;
     RecRoute.Fill = RouteColor;
     // Create the animation path.
     path = new Path();
     path.Stroke = RouteColor;
     path.StrokeThickness = 3;
     animationPath = new PathGeometry();
     pFigure = new PathFigure();
     route = new PolyLineSegment();
     path.Data = animationPath;
     pFigure.Segments.Add(route);
     animationPath.Figures.Add(pFigure);
     MapInit();
     //修改日期:2013-12-1
     //修改日期:2013-12-30
     BindWorkLineCombox();
     BindLineCombox(cbRoute_WorkLine.Text.Trim());
     LoadAllMark();
 }
Ejemplo n.º 18
0
        //if pencil is selected and brush color is not null (it is not null all the time since before performing
        //mouseMove we perform mouseDown where we predefine brushColor attribute to colorPicker
        public void MouseMove(Point newPosition, Canvas canvas1)
        {
            if (selected && brushColor!=null)
            {
                //Approach 2
                //tried to make it this way because once the thickness of line increases it doesn't look good.
                //instead of being connected lines looks like |||||| especially on turns.
                //so far this approach doesn't solve the problem.
                Path linePath = new Path();
                linePath.Stroke = new SolidColorBrush(brushColor);
                linePath.StrokeThickness = brushThickness;
                linePath.Fill = new SolidColorBrush(brushColor);

                LineGeometry line = new LineGeometry();
                line.StartPoint = new Point(currentPoint.X, currentPoint.Y);
                line.EndPoint = new Point(newPosition.X, newPosition.Y);

                linePath.Data = line;
                //original approach 1
                //line.Stroke = new SolidColorBrush(brushColor);
                ////manipulate lines thickness
                //line.StrokeThickness = brushThickness;
                //line.X1 = currentPoint.X;
                //line.Y1 = currentPoint.Y;
                //line.X2 = newPosition.X;
                //line.Y2 = newPosition.Y;

                //line.SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased);

                canvas1.Children.Add(linePath);

                currentPoint = newPosition;
            }
        }
        private void RenderArc(double Angle, Path pathRoot, PathFigure pathFigure, ArcSegment arcSegment)
        {
            Point startPoint = new Point(Radius, 0);
            Point endPoint = ComputeCartesianCoordinate(Angle, Radius);
            endPoint.X += Radius;
            endPoint.Y += Radius;

            pathRoot.Width = Radius * 2 + StrokeThickness;
            pathRoot.Height = Radius * 2 + StrokeThickness;
            pathRoot.Margin = new Thickness(StrokeThickness, StrokeThickness, 0, 0);

            bool largeArc = Angle > 180.0;

            Size outerArcSize = new Size(Radius, Radius);

            pathFigure.StartPoint = startPoint;

            if (startPoint.X == Math.Round(endPoint.X) && startPoint.Y == Math.Round(endPoint.Y))
            {
                endPoint.X -= 0.01;
            }

            arcSegment.Point = endPoint;
            arcSegment.Size = outerArcSize;
            arcSegment.IsLargeArc = largeArc;
        }
Ejemplo n.º 20
0
        public geometryLine(Canvas cvs)
        {
            rootPanel = cvs;
            //myPathFigure = new PathFigure();
            myPathGeometry = new PathGeometry();
            //myPathGeometry.Figures.Add(myPathFigure);

            myPath = new Path();
            myPath.Stroke = Brushes.Blue;
            myPath.StrokeThickness = 1;
            myPath.Data = myPathGeometry;
            rootPanel.Children.Add(myPath);

            myPathFigureOld = new PathFigure();
            myPathGeometryOld = new PathGeometry();
            myPathGeometryOld.Figures.Add(myPathFigureOld);

            myPathOld = new Path();
            myPathOld.Stroke = Brushes.Blue;
            myPathOld.StrokeThickness = 1;
            myPathOld.Data = myPathGeometryOld;

            rootPanel.Children.Add(myPathOld);
            myPathFigureTest = new PathFigure();
            myPathGeometry.Figures.Add(myPathFigureTest);

            isFirstPoint = true;
        }
Ejemplo n.º 21
0
		public override void OnApplyTemplate()
		{
			line1 = GetTemplateChild("line1") as Path;
			line2 = GetTemplateChild("line2") as Path;

			base.OnApplyTemplate();
		}
        private void AddArrow(Panel rootCanvas, Point arrowPoint)
        {
            var size = 10.0;

            var relationshipPath = new Path
            {
                Stroke = Brushes.Black,
                StrokeThickness = 2,
                Visibility = Visibility.Visible,
                Fill = Brushes.Black
            };

            var geometry = new StreamGeometry
            {
                FillRule = FillRule.EvenOdd
            };

            using (var ctx = geometry.Open())
            {
                ctx.BeginFigure(new Point(arrowPoint.X, arrowPoint.Y), true, true);

                ctx.LineTo(new Point(arrowPoint.X - size / 2, arrowPoint.Y - size), true, true);
                ctx.LineTo(new Point(arrowPoint.X + size / 2, arrowPoint.Y - size), true, true);
            }

            geometry.Freeze();

            relationshipPath.Data = geometry;
            rootCanvas.Children.Add(relationshipPath);
        }
Ejemplo n.º 23
0
 public void UpdatePath(Path path, Point sp, Point ep)
 {
     using (StreamGeometryContext cnt = ((StreamGeometry)(path.Data)).Open())
     {
         InternalDrawGeometry(cnt, sp, ep);
     }
 }
Ejemplo n.º 24
0
        public GraphmapsEdge(Edge edge, FrameworkElement labelFrameworkElement) {
            Edge = edge;
            CurvePath = new Path {
                Data = GetICurveWpfGeometry(edge.GeometryEdge.Curve),
                Tag = this
            };

            EdgeAttrClone = edge.Attr.Clone();

            if (edge.Attr.ArrowAtSource)
                SourceArrowHeadPath = new Path {
                    Data = DefiningSourceArrowHead(),
                    Tag = this
                };
            if (edge.Attr.ArrowAtTarget)
                TargetArrowHeadPath = new Path {
                    Data = DefiningTargetArrowHead(Edge.GeometryEdge.EdgeGeometry, PathStrokeThickness),
                    Tag = this
                };

            SetPathStroke();

            if (labelFrameworkElement != null) {
                LabelFrameworkElement = labelFrameworkElement;
                Common.PositionFrameworkElement(LabelFrameworkElement, edge.Label.Center, 1);
            }
            edge.Attr.VisualsChanged += (a, b) => Invalidate();
            
        }
Ejemplo n.º 25
0
        //gridLine constructor
        public gridLine(int value, string dir, MainWindow window)
        {
            // Create a path to draw a geometry with.
            line = new Path();
            line.Stroke = Brushes.WhiteSmoke;
            line.StrokeThickness = 0.5;
            line.SnapsToDevicePixels = true;

            //this.line = new Line();
            this.canvas = window.plot;
            this.view = window.view;
            this.direction = dir;
            this.window = window;

            creategeometry(value);

            if (dir == LineDirection.Horizontal)
            {
                TextLabel(5, value, value.ToString());
            }
            else
            {
                TextLabel(value + 1, 30, value.ToString());
            }


            canvas.Children.Add(line);
        }
Ejemplo n.º 26
0
        public HologramDisplay2(Hologram2 holo)
        {
            hologram2 = holo;
            InitializeComponent();
            Path PathInstance = new Path();
            PathInstance.PathId = holo.video;
            this.DataContext = PathInstance;

            myMediaElement1.LoadedBehavior = MediaState.Manual;
            myMediaElement2.LoadedBehavior = MediaState.Manual;
            myMediaElement3.LoadedBehavior = MediaState.Manual;
            myMediaElement4.LoadedBehavior = MediaState.Manual;

            myMediaElement1.MediaEnded += new RoutedEventHandler(myMediaElement1_MediaEnded);
            myMediaElement2.MediaEnded += new RoutedEventHandler(myMediaElement2_MediaEnded);
            myMediaElement3.MediaEnded += new RoutedEventHandler(myMediaElement3_MediaEnded);
            myMediaElement4.MediaEnded += new RoutedEventHandler(myMediaElement4_MediaEnded);

            myMediaElement1.MediaOpened += new RoutedEventHandler(myMediaElement1_MediaOpened);
            

            myMediaElement1.Play();
            myMediaElement2.Play();
            myMediaElement3.Play();
            myMediaElement4.Play();
            state = "play";
        }
        public void Draw(EasingFunctionBase easingFunction)
        {
            canvas1.Children.Clear();


            PathSegmentCollection pathSegments = new PathSegmentCollection();

            for (double i = 0; i < 1; i += _samplingInterval)
            {
                double x = i * canvas1.Width;
                double y = easingFunction.Ease(i) * canvas1.Height;

                var segment = new LineSegment();
                segment.Point = new Point(x, y);

                pathSegments.Add(segment);

            }
            var p = new Path();
            p.Stroke = new SolidColorBrush(Colors.Black);
            p.StrokeThickness = 3;
            PathFigureCollection figures = new PathFigureCollection();
            figures.Add(new PathFigure() { Segments = pathSegments });
            p.Data = new PathGeometry() { Figures = figures };
            canvas1.Children.Add(p);
        }
Ejemplo n.º 28
0
 public AxesFrame()
 {
     canvas = new AxisCanvas();
     this.Content = canvas;
     frame = new Path() { Stroke = Brushes.Black, StrokeThickness = 1, StrokeLineJoin = PenLineJoin.Miter, Data = geometry };
     canvas.Children.Add(frame);
 }
Ejemplo n.º 29
0
        public static Shape DrawLinkArrow(Point p1, Point p2, bool canLearn) //helper to put an arrow in a synapse line
        {
            GeometryGroup lineGroup = new GeometryGroup();
            double        theta     = Math.Atan2((p2.Y - p1.Y), (p2.X - p1.X)) * 180 / Math.PI;

            PathGeometry pathGeometry = new PathGeometry();
            PathFigure   pathFigure   = new PathFigure();
            //            Point p = new Point(p1.X + ((p2.X - p1.X) / 1.35), p1.Y + ((p2.Y - p1.Y) / 1.35));
            Vector v = p2 - p1;

            //v = v / v.Length * (dp.NeuronDisplaySize / 2);
            v = v / 2;
            Point p = new Point();

            p = p2 - v;
            pathFigure.StartPoint = p;
            double arrowWidth  = dp.NeuronDisplaySize / 20;
            double arrowLength = dp.NeuronDisplaySize / 15;

            if (canLearn)
            {
                arrowWidth *= 2;
            }
            Point       lpoint = new Point(p.X + arrowWidth, p.Y + arrowLength);
            Point       rpoint = new Point(p.X - arrowWidth, p.Y + arrowLength);
            LineSegment seg1   = new LineSegment();

            seg1.Point = lpoint;
            pathFigure.Segments.Add(seg1);

            LineSegment seg2 = new LineSegment();

            seg2.Point = rpoint;
            pathFigure.Segments.Add(seg2);

            LineSegment seg3 = new LineSegment();

            seg3.Point = p;
            pathFigure.Segments.Add(seg3);

            pathGeometry.Figures.Add(pathFigure);
            RotateTransform transform = new RotateTransform();

            transform.Angle        = theta + 90;
            transform.CenterX      = p.X;
            transform.CenterY      = p.Y;
            pathGeometry.Transform = transform;
            lineGroup.Children.Add(pathGeometry);

            LineGeometry connectorGeometry = new LineGeometry();

            connectorGeometry.StartPoint = p1;
            connectorGeometry.EndPoint   = p2;
            lineGroup.Children.Add(connectorGeometry);
            System.Windows.Shapes.Path path = new System.Windows.Shapes.Path();
            path.Data            = lineGroup;
            path.StrokeThickness = 2;
            path.Stroke          = path.Fill = Brushes.Red;
            return(path);
        }
Ejemplo n.º 30
0
        public Triangle()
        {
            InitializeComponent();

            l1 = new LineSegment();
            l2 = new LineSegment();

            f = new PathFigure();
            f.Segments.Add(l1);
            f.Segments.Add(l2);
            f.IsClosed = true;

            PathGeometry g = new PathGeometry();
            g.Figures.Add(f);

            Path p = new Path();
            this.SetBinding(FillProperty, new Binding("Fill") { Source = p, Mode = BindingMode.TwoWay });
            this.SetBinding(StrokeProperty, new Binding("Stroke") { Source = p, Mode = BindingMode.TwoWay });
            this.SetBinding(StrokeThicknessProperty, new Binding("StrokeThickness") { Source = p, Mode = BindingMode.TwoWay });
            p.Data = g;

            this.Fill = new SolidColorBrush(Colors.White);
            this.Stroke = new SolidColorBrush(Colors.Black);

            this.LayoutRoot.Children.Add(p);
        }
        public static TextDecoration Squiggly(Color color, TextDecorationLocation location = TextDecorationLocation.Underline)
        {
            var penVisual = new Path
            {
                Stroke = new SolidColorBrush(color),
                StrokeThickness = 0.2,
                StrokeEndLineCap = PenLineCap.Square,
                StrokeStartLineCap = PenLineCap.Square,
                Data = new PathGeometry(new[] { new PathFigure(new Point(0, 1), new[] { new BezierSegment(new Point(1, 0), new Point(2, 2), new Point(3, 1), true) }, false) })
            };

            var penBrush = new VisualBrush
            {
                Viewbox = new Rect(0, 0, 3, 2),
                ViewboxUnits = BrushMappingMode.Absolute,
                Viewport = new Rect(0, 0.8, 6, 3),
                ViewportUnits = BrushMappingMode.Absolute,
                TileMode = TileMode.Tile,
                Visual = penVisual
            };

            var pen = new Pen
            {
                Brush = penBrush,
                Thickness = 6
            };

            return new TextDecoration(location, pen, 0, TextDecorationUnit.FontRecommended, TextDecorationUnit.FontRecommended);
        }
 public void InitializeComponent()
 {
     if (!this._contentLoaded)
     {
         this._contentLoaded = true;
         Application.LoadComponent(this, new Uri("/TWC.OVP;component/Views/CaptionSettingsView.xaml", UriKind.Relative));
         this.userControl = (UserControl) base.FindName("userControl");
         this.LayoutRoot = (Grid) base.FindName("LayoutRoot");
         this.DialogBorder = (Border) base.FindName("DialogBorder");
         this.BackgroundRectangle = (Border) base.FindName("BackgroundRectangle");
         this.Gradient = (Rectangle) base.FindName("Gradient");
         this.HeaderGrid = (Grid) base.FindName("HeaderGrid");
         this.GlyphCanvas = (Canvas) base.FindName("GlyphCanvas");
         this.BoxPath = (Path) base.FindName("BoxPath");
         this.CPath1 = (Path) base.FindName("CPath1");
         this.CPath2 = (Path) base.FindName("CPath2");
         this.CheckedBoxPath = (Path) base.FindName("CheckedBoxPath");
         this.CheckedCPath1 = (Path) base.FindName("CheckedCPath1");
         this.CheckedCPath2 = (Path) base.FindName("CheckedCPath2");
         this.CaptionSettingsLayoutRoot = (Grid) base.FindName("CaptionSettingsLayoutRoot");
         this.MetaDataBackground = (Rectangle) base.FindName("MetaDataBackground");
         this.CharacterSettingsLayoutRoot = (Grid) base.FindName("CharacterSettingsLayoutRoot");
         this.FooterGrid = (Grid) base.FindName("FooterGrid");
         this.DefaultsButton = (Button) base.FindName("DefaultsButton");
         this.CloseButton = (Button) base.FindName("CloseButton");
     }
 }
Ejemplo n.º 33
0
        public VEdge(Edge edge, FrameworkElement labelFrameworkElement) {
            Edge = edge;
            CurvePath = new Path {
                Data = GetICurveWpfGeometry(edge.GeometryEdge.Curve),
                Tag = this
            };

            EdgeAttrClone = edge.Attr.Clone();

            if (edge.Attr.ArrowAtSource)
                SourceArrowHeadPath = new Path {
                    Data = DefiningSourceArrowHead(),
                    Tag = this
                };
            if (edge.Attr.ArrowAtTarget)
                TargetArrowHeadPath = new Path {
                    Data = DefiningTargetArrowHead(Edge.GeometryEdge.EdgeGeometry, PathStrokeThickness),
                    Tag = this
                };

            SetPathStroke();

            if (labelFrameworkElement != null) {
                LabelFrameworkElement = labelFrameworkElement;
                Common.PositionFrameworkElement(LabelFrameworkElement, edge.Label.Center, 1);
            }
            edge.Attr.VisualsChanged += (a, b) => Invalidate();

            edge.IsVisibleChanged += obj => {
                foreach (var frameworkElement in FrameworkElements) {
                    frameworkElement.Visibility = edge.IsVisible ? Visibility.Visible : Visibility.Hidden;
                }
            };
        }
Ejemplo n.º 34
0
        public void SelectTest()
        {
            PathCollection target = new PathCollection(@"E:\jawi\khots");
            //alef raw data
            string alef = "M2.8853219,14.535578L3.4452919,24.413808 6.0826619,72.682508C6.0826619,72.682508 7.8725619,70.888858 8.9450019,69.255188 10.466172,66.940318 10.546172,64.950418 11.003652,62.728038 11.362382,60.984378 11.386132,60.595648 11.238632,58.834488L8.3512919,24.397558 8.0763019,18.551618C8.3637919,18.709108,8.6375219,18.851598,8.8950119,18.977838L13.337272,21.177728 12.489822,18.840348C12.393622,18.575368 12.291082,18.294128 12.188582,18.011638 10.956152,14.616818 10.272432,11.259498 9.4512319,7.77842770000001 8.6662719,4.44610770000001 7.6188219,0.00758770000001263 7.6188219,0.00758770000001263 7.6188219,0.00758770000001263 6.8776119,-0.0311122999999874 6.1939019,0.0662877000000126 4.3165019,0.335027700000013 0.307961849999997,6.31470770000001 0.0479718499999979,7.67338770000001 0.0229718499999979,7.80212770000001 0.00797184999999793,7.93087770000001 0.00297184999999793,8.05836770000001 -0.00832815000000207,8.33959770000001 0.0129718499999979,8.63458770000001 0.0604718499999979,8.93956770000001 0.404201849999998,11.129458 1.5066519,12.998108 2.8853219,14.535528z";
            Path path = new Path();
            path.Data = (Geometry)new GeometryConverter().ConvertFromString(alef);

            PathViewModel viewModel = new PathViewModel(string.Empty, path, string.Empty);
            target.Select(viewModel);
            //check SelectedPath
            Assert.AreEqual(target.SelectedPath.Path.Data.ToString(), viewModel.Path.Data.ToString());

            //ensure always only one Item IsChecked.
            int count = 0;
            foreach (PathViewModel item in target.Items)
                if (item.IsChecked) count++;
            Assert.AreEqual(1, count);

            //select next object.
            string dot = "M3.1054696,15.75434C3.6094426,18.82793 4.5492686,23.76517 4.0869176,25.03635 3.7460606,25.97381 3.0559716,26.66627 2.4212556,27.49747 -0.2264804,30.96604 -0.6113344,35.03333 0.8220896,39.70933 2.3521336,44.70032 7.7263506,42.62043 12.616468,39.51934 15.53069,37.67069 22.65219,32.61096 24.193108,29.29988 24.278228,29.11614 24.35785,28.92865 24.432221,28.73616 23.762131,26.18129 21.683116,28.80496 21.676741,28.80866 13.716785,34.24837 5.3694746,37.5407 2.7644876,36.5195 2.1845176,36.29201 1.8942836,35.68829 2.2572636,34.40961 2.4872516,33.5984 2.9583516,32.7547 3.0645966,32.6272 4.2296596,31.21978 6.6485326,29.7861 8.1425786,28.15369 9.0814046,27.12749 9.6549996,26.02255 10.645197,25.32509 11.898881,24.44264 13.820405,24.21265 15.293827,23.55393 19.110751,21.84777 22.053346,17.22927 22.415827,13.61696 23.065668,7.1410503 19.6006,5.0074103 13.9169,1.0438703 13.15794,0.5139003 12.546472,0.0951703 11.285414,0.0151703000000001 9.9611076,-0.0685296999999999 7.9205906,0.2214103 7.9205906,0.2214103 7.9205906,0.2214103 7.8168456,3.3425003 8.2474486,5.5648803 8.7287976,8.0485003 9.8782376,9.4096803 10.368087,11.07084 10.477081,11.44082 10.553452,11.8258 10.422457,11.95954 10.287464,12.09704 9.9326076,11.96854 9.5935006,11.75455 6.9287656,10.06839 6.7901486,7.6610203 4.6721346,8.7434603 3.5073216,9.3396803 2.9713496,10.73336 2.8809796,12.64201 2.8233596,13.85944 2.8458596,14.17068 3.1054676,15.75434z M12.059248,8.3897303L11.909756,7.1123003C11.909756,7.1123003 12.745087,6.9660603 13.331431,7.0248003 14.077891,7.1010003 14.420623,7.5122803 14.86935,7.9035103 17.496086,10.19839 20.907657,11.09834 19.429234,13.39572 19.191497,13.76445 17.71095,15.29812 16.400519,16.42056 14.615988,17.94923 13.518921,18.30171 13.693787,16.38806 13.965647,13.41697 11.998626,7.8710103 12.059248,8.3897303z M9.0800296,19.17791L7.4994876,19.27421C6.7894006,19.31791 6.6677816,19.30921 6.2840516,19.19541 5.5918386,18.99042 4.7182596,18.27046 4.3830266,17.58425 4.2211606,17.25301 4.1994116,17.15302 4.1646636,16.5843L4.0872936,15.32062 5.3517266,15.24312C5.9198216,15.20812 6.0216916,15.21812 6.3701736,15.33812 7.3446216,15.67435 8.8960406,17.33176 8.9930346,17.75549 9.1320276,18.36296 9.0800346,19.17791 9.0800346,19.17791z";
            Path path2 = new Path();
            path2.Data = (Geometry)new GeometryConverter().ConvertFromString(dot);
            PathViewModel viewModel2 = new PathViewModel(string.Empty, path2, string.Empty);
            target.Select(viewModel2);
            //check SelectedPath
            Assert.AreEqual(target.SelectedPath.Path.Data.ToString(), path2.Data.ToString());

            //ensure always only one Item IsChecked.
            count = 0;
            foreach (PathViewModel item in target.Items)
                if (item.IsChecked) count++;
            Assert.AreEqual(1, count);
        }
Ejemplo n.º 35
0
        protected void Initialize()
        {
            System.IO.DirectoryInfo directoryInfo = new System.IO.DirectoryInfo(source);
            System.IO.FileInfo[] filesInfo = directoryInfo.GetFiles();
            var files = filesInfo.OrderBy(f => f.FullName);//sort alphabetically
            //foreach (System.IO.FileInfo info in filesInfo)
            foreach(System.IO.FileInfo info in files)
            {
                //System.Diagnostics.Debug.WriteLine("Reading " + info.Name + "...");

                SvgReader reader = new SvgReader(info.FullName);
                //HACK: At this moment only support one Path in a template file. Ideal case is get a group of graphic object.
                var elements = reader.GetXMLElements("path");
                foreach (XElement element in elements)
                {
                    Path path = new Path();
                    path.Fill = Brushes.Black;
                    XAttribute attribute = element.Attribute(XName.Get("d"));
                    path.Data = (Geometry)new GeometryConverter().ConvertFromString(attribute.Value);//key

                    //string name = info.Name.ToLower().TrimEnd(new char[] { 'g', 'v', 's', '.' });//caused some ended with 's' interpreted wrongly.
                    string name = info.Name.ToLower().Substring(0, info.Name.Length - 4);
                    string label = GetLabel(info.Name);
                    if (label.Length > 0) name = name.Replace(label, string.Empty);

                    PathViewModel item = new PathViewModel(name, path, label);
                    this.items.Add(item);
                    break;
                }
            }//end loops
        }
Ejemplo n.º 36
0
		public void ComputeActualWidth ()
		{
			var c = new Path ();

			Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired0");
			Assert.AreEqual (new Size (0,0), new Size (c.ActualWidth,c.ActualHeight), "c actual0");

			c.MaxWidth = 25;
			c.Width = 50;
			c.MinHeight = 33;

			Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired1");
			Assert.AreEqual (new Size (25,33), new Size (c.ActualWidth,c.ActualHeight), "c actual1");
			Assert.AreEqual (new Rect (0,0,0,0), LayoutInformation.GetLayoutSlot (c), "c slot1");

			c.Measure (new Size (100, 100));

			Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired2");
			Assert.AreEqual (new Size (25,33), new Size (c.ActualWidth,c.ActualHeight), "c actual2");
			Assert.AreEqual (new Size (0,0), c.RenderSize, "c render2");

			c.Arrange (new Rect (0,0,c.DesiredSize.Width,c.DesiredSize.Height));

			Assert.AreEqual (new Size (0,0), c.DesiredSize, "c desired3");
			Assert.AreEqual (new Size (25,33), new Size (c.ActualWidth,c.ActualHeight), "c actual3");
			Assert.AreEqual (new Size (0,0), c.RenderSize, "c render3");
		}
Ejemplo n.º 37
0
		private void AddCircularArcGraph(Point startPoint, Point endPoint, Size size)
		{
			PathFigure pf = new PathFigure();
			pf.StartPoint = new Point(startPoint.X, startPoint.Y);

			ArcSegment arcSegment = new ArcSegment();
			arcSegment.Point = new Point(endPoint.X, endPoint.Y);
			arcSegment.Size = size;
			arcSegment.SweepDirection = SweepDirection.Counterclockwise;

			PathSegmentCollection psc = new PathSegmentCollection();
			psc.Add(arcSegment);

			pf.Segments = psc;

			PathFigureCollection pfc = new PathFigureCollection();
			pfc.Add(pf);

			PathGeometry pg = new PathGeometry();
			pg.Figures = pfc;

			var path = new Path();
			path.Stroke = Brushes.Black;
			path.StrokeThickness = 1;
			path.Data = pg;
			path.Fill = Brushes.Orange;
			path.Stretch = Stretch.Fill;

			var viewportPanel = new ViewportHostPanel();
			ViewportPanel.SetViewportBounds(path, new DataRect(0, 0, 50, 50));
			viewportPanel.Children.Add(path);
			plotter.Children.Add(viewportPanel);
		}
Ejemplo n.º 38
0
 private void Draw()
 {
     Path ellipsePath = new Path
     {
         Fill = new SolidColorBrush(Colors.White),
         StrokeThickness = StrokeThikness,
         Stroke = BorderBrush,
         Data = GetCircleGeometry(0, 2 * Math.PI, ActualWidth, ActualHeight)
     };
     Path filledEllipse = new Path
     {
         Fill = Foreground,
         StrokeThickness = StrokeThikness,
         Stroke = BorderBrush,
         Data = GetCircleGeometry(StartAngle, FillingAngle, ActualWidth, ActualHeight)
     };
     Path additionalEllipse = new Path
     {
         Fill = new SolidColorBrush(Color.FromArgb(224, 229,229,229)),
         StrokeThickness = 0,
         Data = GetCircleGeometry(0, 2*Math.PI, ActualWidth * 0.75, ActualHeight*0.75),
         HorizontalAlignment=HorizontalAlignment.Center,
         VerticalAlignment = VerticalAlignment.Center
     };
     this.MainGrid.Children.Add(ellipsePath);
     this.MainGrid.Children.Add(filledEllipse);
     this.MainGrid.Children.Add(additionalEllipse);
 }
Ejemplo n.º 39
0
        public EllipseGeometryExample()
        {
            NameScope.SetNameScope(this, new NameScope());

            WindowTitle = "EllipseGeometry Animation Example";

            Canvas myCanvas = new Canvas();

            myCanvas.Width  = 400;
            myCanvas.Height = 400;
            myCanvas.Margin = new Thickness(20);

            // Create a Path object to contain the geometry.
            System.Windows.Shapes.Path myPath =
                new System.Windows.Shapes.Path();
            myPath.Fill            = System.Windows.Media.Brushes.Blue;
            myPath.Stroke          = System.Windows.Media.Brushes.Black;
            myPath.StrokeThickness = 5;

            // Create an EllipseGeometry.
            System.Windows.Media.EllipseGeometry myEllipseGeometry =
                new System.Windows.Media.EllipseGeometry();
            myEllipseGeometry.Center  = new System.Windows.Point(200, 200);
            myEllipseGeometry.RadiusX = 25;
            myEllipseGeometry.RadiusY = 50;

            // Register a name for the geometry so that it can
            // be targeted by animations.
            this.RegisterName("MyEllipseGeometry", myEllipseGeometry);

            // Add the geometry to the Path.
            myPath.Data = myEllipseGeometry;
            myCanvas.Children.Add(myPath);
            this.Content = myCanvas;

            // Create a PointAnimation to animate the center of the ellipse.
            PointAnimation myPointAnimation = new PointAnimation();

            myPointAnimation.From     = new System.Windows.Point(200, 200);
            myPointAnimation.To       = new System.Windows.Point(50, 50);
            myPointAnimation.Duration =
                new Duration(TimeSpan.FromMilliseconds(5000));
            myPointAnimation.AutoReverse    = true;
            myPointAnimation.RepeatBehavior = RepeatBehavior.Forever;

            Storyboard.SetTargetName(myPointAnimation, "MyEllipseGeometry");
            Storyboard.SetTargetProperty(myPointAnimation,
                                         new PropertyPath(EllipseGeometry.CenterProperty));
            Storyboard myStoryboard = new Storyboard();

            myStoryboard.Children.Add(myPointAnimation);

            // Use an anonymous event handler to begin the animation
            // when the path is loaded.
            myPath.Loaded += delegate(object sender, RoutedEventArgs args)
            {
                myStoryboard.Begin(myPath);
            };
        }
Ejemplo n.º 40
0
        private void InitializePathAndItsAnimation(System.Windows.Shapes.Path path, DoubleAnimation animation)
        {
            var length = path.Data.GetProximateLength() / path.StrokeThickness;

            path.StrokeDashOffset = length;
            path.StrokeDashArray  = new DoubleCollection(new[] { length, length });
            animation.From        = length;
        }
Ejemplo n.º 41
0
 public RoundedCornersPolygon()
 {
     var geometry = new PathGeometry();
     geometry.Figures.Add(new PathFigure());
     _path = new Path {Data = geometry};
     Points = new PointCollection();
     Points.Changed += Points_Changed;
 }
Ejemplo n.º 42
0
 public void Excute()
 {
     if (mState == null)
         return;
     int id =  mState.AddJunc2Data(mCover);
     mCover.juncInfo.ID = id;
     mPath =  mState.AddJunc(mCover);
 }
Ejemplo n.º 43
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.gridLayout = ((System.Windows.Controls.Grid)(target));
                return;

            case 2:
                this.menu = ((System.Windows.Controls.ContextMenu)(target));

            #line 16 "..\..\..\..\Views\Controls\ChatImage.xaml"
                this.menu.AddHandler(System.Windows.Controls.MenuItem.ClickEvent, new System.Windows.RoutedEventHandler(this.ContextMenu_Click));

            #line default
            #line hidden

            #line 16 "..\..\..\..\Views\Controls\ChatImage.xaml"
                this.menu.Opened += new System.Windows.RoutedEventHandler(this.menu_Opened);

            #line default
            #line hidden
                return;

            case 3:
                this.Forward = ((System.Windows.Controls.MenuItem)(target));
                return;

            case 4:
                this.pathResend = ((System.Windows.Shapes.Path)(target));
                return;

            case 5:
                this.img = ((System.Windows.Controls.Image)(target));
                return;

            case 6:
                this.imgGif = ((IM.Emoje.Controls.GifImage)(target));
                return;

            case 7:
                this.gridFail = ((System.Windows.Controls.Grid)(target));
                return;

            case 8:
                this.tbLoadFail = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 9:
                this.gridLoading = ((System.Windows.Controls.Grid)(target));
                return;

            case 10:
                this.aniLoading = ((IMClient.Views.Controls.AnimationLoading)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 44
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.ButtonClose = ((System.Windows.Controls.Button)(target));

            #line 66 "..\..\MainWindow.xaml"
                this.ButtonClose.Click += new System.Windows.RoutedEventHandler(this.ButtonClose_Click);

            #line default
            #line hidden
                return;

            case 2:
                this.path = ((System.Windows.Shapes.Path)(target));
                return;

            case 3:
                this.path2 = ((System.Windows.Shapes.Path)(target));
                return;

            case 4:
                this.path3 = ((System.Windows.Shapes.Path)(target));
                return;

            case 5:
                this.path1 = ((System.Windows.Shapes.Path)(target));
                return;

            case 6:
                this.stackPanel = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 7:
                this.MsgError = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 8:
                this.UserName = ((System.Windows.Controls.TextBox)(target));
                return;

            case 9:
                this.Pwd = ((System.Windows.Controls.PasswordBox)(target));
                return;

            case 10:
                this.ButtonLogin = ((System.Windows.Controls.Button)(target));

            #line 124 "..\..\MainWindow.xaml"
                this.ButtonLogin.Click += new System.Windows.RoutedEventHandler(this.ButtonLogin_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 45
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/ResourceFramework;component/UserControls/Weapons/WaterBalloon.xaml", System.UriKind.Relative));
     this.uc_WaterBalloon    = ((System.Windows.Controls.UserControl)(this.FindName("uc_WaterBalloon")));
     this.LayoutRoot         = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot")));
     this.weaponOrigin       = ((System.Windows.Controls.Canvas)(this.FindName("weaponOrigin")));
     this.weaponBulletOrigin = ((System.Windows.Controls.Canvas)(this.FindName("weaponBulletOrigin")));
     this.WaterBalloon1      = ((System.Windows.Controls.Viewbox)(this.FindName("WaterBalloon1")));
     this.Path_32            = ((System.Windows.Shapes.Path)(this.FindName("Path_32")));
     this.Path_33            = ((System.Windows.Shapes.Path)(this.FindName("Path_33")));
     this.Path_34            = ((System.Windows.Shapes.Path)(this.FindName("Path_34")));
     this.Path_35            = ((System.Windows.Shapes.Path)(this.FindName("Path_35")));
     this.WaterBalloon2      = ((System.Windows.Controls.Viewbox)(this.FindName("WaterBalloon2")));
     this.Path_28            = ((System.Windows.Shapes.Path)(this.FindName("Path_28")));
     this.Path_29            = ((System.Windows.Shapes.Path)(this.FindName("Path_29")));
     this.Path_30            = ((System.Windows.Shapes.Path)(this.FindName("Path_30")));
     this.Path_31            = ((System.Windows.Shapes.Path)(this.FindName("Path_31")));
     this.WaterBalloon3      = ((System.Windows.Controls.Viewbox)(this.FindName("WaterBalloon3")));
     this.Path_24            = ((System.Windows.Shapes.Path)(this.FindName("Path_24")));
     this.Path_25            = ((System.Windows.Shapes.Path)(this.FindName("Path_25")));
     this.Path_26            = ((System.Windows.Shapes.Path)(this.FindName("Path_26")));
     this.Path_27            = ((System.Windows.Shapes.Path)(this.FindName("Path_27")));
     this.WaterBalloon4      = ((System.Windows.Controls.Viewbox)(this.FindName("WaterBalloon4")));
     this.Path_20            = ((System.Windows.Shapes.Path)(this.FindName("Path_20")));
     this.Path_21            = ((System.Windows.Shapes.Path)(this.FindName("Path_21")));
     this.Path_22            = ((System.Windows.Shapes.Path)(this.FindName("Path_22")));
     this.Path_23            = ((System.Windows.Shapes.Path)(this.FindName("Path_23")));
     this.WaterBalloon5      = ((System.Windows.Controls.Viewbox)(this.FindName("WaterBalloon5")));
     this.Path_16            = ((System.Windows.Shapes.Path)(this.FindName("Path_16")));
     this.Path_17            = ((System.Windows.Shapes.Path)(this.FindName("Path_17")));
     this.Path_18            = ((System.Windows.Shapes.Path)(this.FindName("Path_18")));
     this.Path_19            = ((System.Windows.Shapes.Path)(this.FindName("Path_19")));
     this.WaterBalloon6      = ((System.Windows.Controls.Viewbox)(this.FindName("WaterBalloon6")));
     this.Path_12            = ((System.Windows.Shapes.Path)(this.FindName("Path_12")));
     this.Path_13            = ((System.Windows.Shapes.Path)(this.FindName("Path_13")));
     this.Path_14            = ((System.Windows.Shapes.Path)(this.FindName("Path_14")));
     this.Path_15            = ((System.Windows.Shapes.Path)(this.FindName("Path_15")));
     this.WaterBalloon7      = ((System.Windows.Controls.Viewbox)(this.FindName("WaterBalloon7")));
     this.Path_08            = ((System.Windows.Shapes.Path)(this.FindName("Path_08")));
     this.Path_09            = ((System.Windows.Shapes.Path)(this.FindName("Path_09")));
     this.Path_10            = ((System.Windows.Shapes.Path)(this.FindName("Path_10")));
     this.Path_11            = ((System.Windows.Shapes.Path)(this.FindName("Path_11")));
     this.WaterBalloon8      = ((System.Windows.Controls.Viewbox)(this.FindName("WaterBalloon8")));
     this.Path_04            = ((System.Windows.Shapes.Path)(this.FindName("Path_04")));
     this.Path_05            = ((System.Windows.Shapes.Path)(this.FindName("Path_05")));
     this.Path_06            = ((System.Windows.Shapes.Path)(this.FindName("Path_06")));
     this.Path_07            = ((System.Windows.Shapes.Path)(this.FindName("Path_07")));
     this.WaterBalloon9      = ((System.Windows.Controls.Viewbox)(this.FindName("WaterBalloon9")));
     this.Path_00            = ((System.Windows.Shapes.Path)(this.FindName("Path_00")));
     this.Path_01            = ((System.Windows.Shapes.Path)(this.FindName("Path_01")));
     this.Path_02            = ((System.Windows.Shapes.Path)(this.FindName("Path_02")));
     this.Path_03            = ((System.Windows.Shapes.Path)(this.FindName("Path_03")));
 }
Ejemplo n.º 46
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.Capa_1 = ((System.Windows.Controls.Canvas)(target));
                return;

            case 2:
                this.g3705 = ((System.Windows.Controls.Canvas)(target));
                return;

            case 3:
                this.g3703 = ((System.Windows.Controls.Canvas)(target));
                return;

            case 4:
                this.path3699 = ((System.Windows.Shapes.Path)(target));
                return;

            case 5:
                this.path3701 = ((System.Windows.Shapes.Path)(target));
                return;

            case 6:
                this.Q1 = ((System.Windows.Controls.PasswordBox)(target));
                return;

            case 7:
                this.Q2 = ((System.Windows.Controls.PasswordBox)(target));
                return;

            case 8:
                this.Q3 = ((System.Windows.Controls.PasswordBox)(target));
                return;

            case 9:
                this.Valider = ((System.Windows.Controls.Button)(target));

            #line 102 "..\..\oubie_pas.xaml"
                this.Valider.Click += new System.Windows.RoutedEventHandler(this.Valider_Click_1);

            #line default
            #line hidden
                return;

            case 10:
                this.Reset = ((System.Windows.Controls.Button)(target));

            #line 108 "..\..\oubie_pas.xaml"
                this.Reset.Click += new System.Windows.RoutedEventHandler(this.Reset_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 47
0
        public void DrawPath(ColourPair colourPair, Model.Path path)
        {
            var aw = ActualWidth;
            var ah = ActualHeight;
            var sw = (aw - GridLineThickness) / GridSize;
            var sh = (ah - GridLineThickness) / GridSize;

            var pathColour = colourPair.DotColour.ToWpfColour();

            var points = new List <Point>();

            // ReSharper disable LoopCanBeConvertedToQuery
            foreach (var coords in path.CoordsList)
            {
                var x = GridLineHalfThickness + (coords.X * sw) + (sw / 2);
                var y = GridLineHalfThickness + ((GridSize - coords.Y - 1) * sh) + (sh / 2);
                points.Add(new Point(x, y));
            }
            // ReSharper restore LoopCanBeConvertedToQuery

            var polyLineSegment = new PolyLineSegment(points, true);
            var pathFigure      = new PathFigure {
                StartPoint = points.First()
            };

            pathFigure.Segments.Add(polyLineSegment);
            var pathGeometry = new PathGeometry();

            pathGeometry.Figures.Add(pathFigure);
            var polyLinePath = new Path
            {
                Tag              = TagType.Path,
                Stroke           = new SolidColorBrush(pathColour),
                StrokeThickness  = sw / 3,
                StrokeEndLineCap = PenLineCap.Round,
                StrokeLineJoin   = PenLineJoin.Round,
                Data             = pathGeometry
            };

            BoardCanvas.Children.Add(polyLinePath);

            // ReSharper disable LoopCanBeConvertedToQuery
            foreach (var coords in path.CoordsList)
            {
                var cellRect           = new Rect(coords.X * sw + GridLineHalfThickness, (GridSize - coords.Y - 1) * sh + GridLineHalfThickness, sw, sh);
                var highlightRectangle = new Rectangle
                {
                    Tag    = TagType.HighlightRectangle,
                    Width  = cellRect.Width,
                    Height = cellRect.Height,
                    Fill   = new SolidColorBrush(Color.FromArgb(0x80, pathColour.R, pathColour.G, pathColour.B))
                };
                Canvas.SetLeft(highlightRectangle, cellRect.Left);
                Canvas.SetTop(highlightRectangle, cellRect.Top);
                BoardCanvas.Children.Add(highlightRectangle);
            }
            // ReSharper restore LoopCanBeConvertedToQuery
        }
Ejemplo n.º 48
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.bg = ((System.Windows.Controls.Grid)(target));
                return;

            case 2:
                this.Stroke = ((System.Windows.Shapes.Path)(target));
                return;

            case 3:
                this.RoundedEdges = ((System.Windows.Shapes.Path)(target));
                return;

            case 4:
                this.BG = ((System.Windows.Shapes.Path)(target));
                return;

            case 5:
                this.pnlHeader = ((System.Windows.Controls.Grid)(target));
                return;

            case 6:
                this.tbHeader = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 7:
                this.txt_MsgHeader = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 8:
                this.txt_MsgBody = ((System.Windows.Controls.TextBox)(target));
                return;

            case 9:
                this.btnOk = ((System.Windows.Controls.Button)(target));

            #line 23 "..\..\..\UserControls\ScrollableMessageBox.xaml"
                this.btnOk.Click += new System.Windows.RoutedEventHandler(this.btnOk_Click);

            #line default
            #line hidden
                return;

            case 10:
                this.btnCancel = ((System.Windows.Controls.Button)(target));

            #line 24 "..\..\..\UserControls\ScrollableMessageBox.xaml"
                this.btnCancel.Click += new System.Windows.RoutedEventHandler(this.btnCancel_Click);

            #line default
            #line hidden
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 49
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="DeptVal"></param>
        /// <param name="OUVal"></param>
        private void AddDeptOUMap(string DeptVal = null, string OUVal = null)
        {
            DockPanel Dept_OU = new DockPanel();

            Dept_OU.Name = "Dept_OU_" + Dept_OU_Count;

            ComboBox Dept = new ComboBox();

            Dept.Name        = "Dept_" + Dept_OU_Count;
            Dept.IsEditable  = true;
            Dept.ItemsSource = Central_Control.osTicket.NUDept_List;
            if (DeptVal != null)
            {
                Dept.Text = DeptVal;
            }

            ComboBox OU = new ComboBox();

            OU.Name                = "OU_" + Dept_OU_Count;
            OU.IsEditable          = true;
            OU.HorizontalAlignment = HorizontalAlignment.Right;
            OU.ItemsSource         = Central_Control.ActiveDirectory.OUs;
            OU.Margin              = new Thickness(3, 2, 2, 2);
            if (OUVal != null)
            {
                OU.Text = OUVal;
            }

            Button Remove = new Button();

            Remove.Name                = "Remove_" + Dept_OU_Count;
            Remove.FontSize            = 8;
            Remove.Style               = FindResource("TinyButton") as Style;
            Remove.HorizontalAlignment = HorizontalAlignment.Right;
            Remove.Content             = "-";
            Remove.Click              += RemoveDeptOUMapping_Click;

            System.Windows.Shapes.Path MinusSign_Path = new System.Windows.Shapes.Path();
            MinusSign_Path.StrokeThickness = 1;
            MinusSign_Path.Height          = 8;
            MinusSign_Path.Width           = 8;
            MinusSign_Path.Style           = FindResource("ButtonPath") as Style;

            LineGeometry MinusSign_Data = new LineGeometry();

            MinusSign_Data.StartPoint = new Point(0, 4);
            MinusSign_Data.EndPoint   = new Point(8, 4);

            Dept_OU_List.Children.Add(Dept_OU);
            Dept_OU.Children.Add(Dept);
            Dept_OU.Children.Add(OU);
            MinusSign_Path.Data = MinusSign_Data;
            Remove.Content      = MinusSign_Path;
            Dept_OU.Children.Add(Remove);

            Dept_OU_Count++;
        }
Ejemplo n.º 50
0
        /// <summary>
        /// 调整大小,并将属性赋予按钮(先走构造函数,再走属性,然后走这个时间关联的方法)
        /// </summary>
        void TomButton3_SizeChanged(object sender, SizeChangedEventArgs e)
        {
            try
            {
                //获取主要的圆
                PP.Ellipse elli = GetChildObject <PP.Ellipse>(this, "elli");

                //左边的反光体
                PP.Path pathLeft = GetChildObject <PP.Path>(this, "pathLeft");
                //上边的反光体
                PP.Ellipse ellTop = GetChildObject <PP.Ellipse>(this, "ellTop");
                //右边的反光体
                PP.Path pathRight = GetChildObject <PP.Path>(this, "pathRight");
                //按钮显示的文本
                TextBlock txtBlcok = GetChildObject <TextBlock>(this, "txtBlock");
                //承载体设置为最合适的尺寸
                elli.Margin = new Thickness(this.ActualWidth * 0.1, this.ActualHeight * 0.1, this.ActualWidth * 0.1, this.ActualHeight * 0.1);
                //反光体设置为最合适的尺寸
                ellTop.Margin    = new Thickness(this.ActualWidth * 0.1, this.ActualHeight * 0.15, this.ActualWidth * 0.15, this.ActualHeight * 0.1);
                pathLeft.Margin  = new Thickness(20, this.ActualHeight * 0.15, this.ActualWidth * 0.6, this.ActualHeight * 0.13);
                pathRight.Margin = new Thickness(this.ActualWidth * 0.5, 0, this.ActualWidth * 0.15, this.ActualHeight * 0.15);

                //属性不为空,更改默认的文本字体
                if (this.ActualWidth != 0)
                {
                    txtBlcok.FontSize = this.ActualWidth * 0.14;
                }

                //属性不为空,更改默认的承载体颜色
                if (tomColor != null)
                {
                    elli.Fill = GetSolicolorBrush(tomColor);
                }
                //属性不为空,更改默认的文本内容
                if (tomText != null)
                {
                    txtBlcok.Text = tomText;
                }
                //属性不为空,更改默认的字体大小
                if (tomTextFont != 0)
                {
                    txtBlcok.FontSize = tomTextFont;
                }
                //属性不为空,更改默认的字体颜色
                if (tomTextForeground != null)
                {
                    txtBlcok.Foreground = tomTextForeground;
                }
            }
            catch (Exception ex)
            {
                MethodLb.CreateLog(this.GetType().FullName, "TomButton3_SizeChanged", ex.ToString(), sender, e);
            }
            finally
            {
            }
        }
        public SurtainTestWindow(List <IEncoding> encodings)
        {
            InitializeComponent();
            CorrectIcon.Visibility = Visibility.Hidden;
            WrongIcon.Visibility   = Visibility.Hidden;

            Encodings = encodings;

            // Генерируем случайное слово
            Word = GetRandomString(rnd.Next(3, 6 + 1));

            MessageBox.Show(Word);

            // Получение большой строки значений
            string code = UniteBinaryValues(FromIntToByte(FromTextToASCII(Word)));

            // Рисование
            const double margin = 10;
            double       xmin   = margin;
            // double xmax = canGraph.Width - margin;
            // double ymin = margin;
            double       ymax = canGraph.Height - margin;
            const double step = 20;

            canGraph.Children.Add(GetXAxis());

            // Make the Y ayis.
            GeometryGroup yaxis_geom = new GeometryGroup();

            yaxis_geom.Children.Add(new LineGeometry(
                                        new Point(xmin, 0), new Point(xmin, canGraph.Height)));
            for (double y = step; y <= canGraph.Height - step; y += step)
            {
                yaxis_geom.Children.Add(new LineGeometry(
                                            new Point(xmin - margin / 2, y),
                                            new Point(xmin + margin / 2, y)));
            }

            Path yaxis_path = new Path
            {
                StrokeThickness = 1,
                Stroke          = Brushes.Black,
                Data            = yaxis_geom
            };

            canGraph.Children.Add(yaxis_path);

            Polyline polyline = Encodings[0].GetGraph(code);

            canGraph.Children.Add(polyline);

            canGraph.Children.Add(Encodings[0].GetSyncTact(code));

            canGraph.Width = (polyline.Points[polyline.Points.Count - 1].X + 50);
            canGraph.Children.Add(GetXAxis());
        }
Ejemplo n.º 52
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.mainWindow = ((PZ3.MainWindow)(target));
                return;

            case 2:
                this.scrollViewer = ((System.Windows.Controls.ScrollViewer)(target));

            #line 11 "..\..\MainWindow.xaml"
                this.scrollViewer.MouseDoubleClick += new System.Windows.Input.MouseButtonEventHandler(this.scrollViewer_MouseDoubleClick);

            #line default
            #line hidden

            #line 11 "..\..\MainWindow.xaml"
                this.scrollViewer.PreviewMouseLeftButtonDown += new System.Windows.Input.MouseButtonEventHandler(this.scrollViewer_PreviewMouseLeftButtonDown);

            #line default
            #line hidden

            #line 11 "..\..\MainWindow.xaml"
                this.scrollViewer.PreviewMouseMove += new System.Windows.Input.MouseEventHandler(this.scrollViewer_PreviewMouseMove);

            #line default
            #line hidden

            #line 11 "..\..\MainWindow.xaml"
                this.scrollViewer.PreviewMouseLeftButtonUp += new System.Windows.Input.MouseButtonEventHandler(this.scrollViewer_PreviewMouseLeftButtonUp);

            #line default
            #line hidden

            #line 11 "..\..\MainWindow.xaml"
                this.scrollViewer.PreviewMouseWheel += new System.Windows.Input.MouseWheelEventHandler(this.scrollViewer_PreviewMouseWheel);

            #line default
            #line hidden
                return;

            case 3:
                this.myCanvas = ((System.Windows.Controls.Canvas)(target));
                return;

            case 4:
                this.path = ((System.Windows.Shapes.Path)(target));
                return;

            case 5:
                this.mainScreen = ((System.Windows.Controls.Image)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 53
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.LayoutRoot = ((System.Windows.Controls.Grid)(target));
                return;

            case 2:
                this.path1 = ((System.Windows.Shapes.Path)(target));
                return;

            case 3:
                this.btnStartTurntable = ((System.Windows.Controls.Button)(target));

            #line 93 "..\..\..\ShowTurnTable.xaml"
                this.btnStartTurntable.Click += new System.Windows.RoutedEventHandler(this.btnStartTurntable_Click);

            #line default
            #line hidden
                return;

            case 4:
                this.thanks_join1 = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 5:
                this.thanks_join2 = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 6:
                this.thanks_join3 = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 7:
                this.thanks_join4 = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 8:
                this.first_prize = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 9:
                this.second_prize = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 10:
                this.third_prize = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 11:
                this.lucky_prize = ((System.Windows.Controls.TextBlock)(target));
                return;
            }
            this._contentLoaded = true;
        }
Ejemplo n.º 54
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:

            #line 10 "..\..\..\LeftWindow.xaml"
                ((MonitorPlatform.LeftWindow)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded);

            #line default
            #line hidden
                return;

            case 2:
                this.maingrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 3:
                this.txtTime = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 4:
                this.tabControl = ((MonitorPlatform.Controls.TabSelectControl)(target));
                return;

            case 5:

            #line 38 "..\..\..\LeftWindow.xaml"
                ((System.Windows.Controls.WrapPanel)(target)).MouseUp += new System.Windows.Input.MouseButtonEventHandler(this.btnExit_MouseUp);

            #line default
            #line hidden
                return;

            case 6:
                this.形状_5 = ((System.Windows.Shapes.Path)(target));
                return;

            case 7:
                this.退出 = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 8:
                this.txtName = ((System.Windows.Controls.TextBlock)(target));
                return;

            case 9:
                this.frame = ((System.Windows.Controls.Frame)(target));
                return;

            case 10:
                this.infoborder = ((System.Windows.Controls.Border)(target));
                return;
            }
            this._contentLoaded = true;
        }
 void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
 {
     switch (connectionId)
     {
     case 1:
         this.root = ((System.Windows.Shapes.Path)(target));
         return;
     }
     this._contentLoaded = true;
 }
Ejemplo n.º 56
0
 public void InitializeComponent()
 {
     if (_contentLoaded)
     {
         return;
     }
     _contentLoaded = true;
     System.Windows.Application.LoadComponent(this, new System.Uri("/ResourceFramework;component/UserControls/NPCs/Arms/RightArm1.xaml", System.UriKind.Relative));
     this.RightArm = ((System.Windows.Shapes.Path)(this.FindName("RightArm")));
 }
Ejemplo n.º 57
0
 public AreaRectTool(Canvas canvas, List <PeTool> undoTool)
     : base(canvas, undoTool)
 {
     areaRectGeom                 = new RectangleGeometry();
     areaRectPath                 = new System.Windows.Shapes.Path();
     areaRectPath.Stroke          = System.Windows.Media.Brushes.Red;
     areaRectPath.StrokeThickness = 1;
     areaRectPath.Data            = areaRectGeom;
     this.eCanvas.Children.Add(areaRectPath);
 }
Ejemplo n.º 58
0
 private Path WrapGeometry(Geometry geometry, ISvgElement element)
 {
     System.Windows.Shapes.Path path = new System.Windows.Shapes.Path();
     if (TryGetTransform(element as ISvgTransformable, out Transform transform))
     {
         geometry.Transform = transform;
     }
     path.Data = geometry;
     return(path);
 }
Ejemplo n.º 59
0
        ///<inheritdoc/>
        public void DrawLineSegments(
            IList <ScreenPoint> points,
            OxyColor stroke,
            double thickness,
            EdgeRenderingMode edgeRenderingMode,
            double[] dashArray,
            LineJoin lineJoin)
        {
            if (this.UseStreamGeometry)
            {
                this.DrawLineSegmentsByStreamGeometry(points, stroke, thickness, edgeRenderingMode, dashArray, lineJoin);
                return;
            }

            Path         path         = null;
            PathGeometry pathGeometry = null;

            int count = 0;

            for (int i = 0; i + 1 < points.Count; i += 2)
            {
                if (path == null)
                {
                    path = this.CreateAndAdd <Path>();
                    this.SetStroke(path, stroke, thickness, edgeRenderingMode, lineJoin, dashArray, 0);
                    pathGeometry = new PathGeometry();
                }

                var actualPoints = this.GetActualPoints(new[] { points[i], points[i + 1] }, path.StrokeThickness, edgeRenderingMode).ToList();

                var figure = new PathFigure {
                    StartPoint = actualPoints[0], IsClosed = false
                };
                figure.Segments.Add(new LineSegment(actualPoints[1], true)
                {
                    IsSmoothJoin = false
                });
                pathGeometry.Figures.Add(figure);

                count++;

                // Must limit the number of figures, otherwise drawing errors...
                if (count > MaxFiguresPerGeometry || dashArray != null)
                {
                    path.Data = pathGeometry;
                    path      = null;
                    count     = 0;
                }
            }

            if (path != null)
            {
                path.Data = pathGeometry;
            }
        }
Ejemplo n.º 60
0
        void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target)
        {
            switch (connectionId)
            {
            case 1:
                this.NavGrid = ((System.Windows.Controls.Border)(target));
                return;

            case 2:
                this.StackPanel = ((System.Windows.Controls.StackPanel)(target));
                return;

            case 3:
                this.TgBtn = ((System.Windows.Controls.Primitives.ToggleButton)(target));
                return;

            case 4:
                this.r1 = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 5:
                this.r2 = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 6:
                this.r3 = ((System.Windows.Shapes.Rectangle)(target));
                return;

            case 7:
                this.HideStackPanel = ((System.Windows.Media.Animation.Storyboard)(target));
                return;

            case 8:
                this.ShowStackPanel = ((System.Windows.Media.Animation.Storyboard)(target));
                return;

            case 9:
                this.ListView = ((System.Windows.Controls.ListView)(target));
                return;

            case 10:
                this.NotificationGrid = ((System.Windows.Controls.Grid)(target));
                return;

            case 11:
                this.CloseButton = ((System.Windows.Controls.Button)(target));
                return;

            case 12:
                this.ButtonContent = ((System.Windows.Shapes.Path)(target));
                return;
            }
            this._contentLoaded = true;
        }