예제 #1
0
 public static void Draw(DrawDelegate MakeDelegate)
 {
     if (staticNewTargets.Count() <= 0)
     {
         return;
     }
     while (staticNewTargets.Count() > 0)
     {
         TargetUI targetUI = new TargetUI(staticNewTargets[0]);
         staticStuffTargets.Add(targetUI);
         MakeDelegate(ref targetUI);
         staticNewTargets.RemoveAt(0);
     }
 }
예제 #2
0
        private bool DrawTarget(ref TargetUI targetUI)
        {
            Ellipse eNewTarget = new Ellipse();
            //设置颜色
            SolidColorBrush mySolidColorBrush = new SolidColorBrush();

            mySolidColorBrush.Color = Color.FromArgb(255, 100, 149, 237);
            eNewTarget.Fill         = mySolidColorBrush;
            //设置在画布的位置
            canvas2D.Children.Add(eNewTarget);
            //设置大小、位置
            BindTarget(ref eNewTarget, ref targetUI);
            //设置呈现变形
            eNewTarget.RenderTransform = targetUI.TT;
            //关联target实例
            targetUI.UIElement        = eNewTarget;
            targetUI.ShowEncoderValue = currentEncoderValue;
            return(true);
        }
예제 #3
0
        private void BindTarget(ref Ellipse eNewTarget, ref TargetUI targetUI)
        {
            MultiBinding MBTargetR = new MultiBinding()
            {
                Converter = new TargetSizeConverter()
            };

            MBTargetR.Bindings.Add(new Binding("TargetRadius")
            {
                Source = m_staticValue
            });
            MBTargetR.Bindings.Add(new Binding("ScreenRate")
            {
                Source = m_staticValue
            });
            MBTargetR.Bindings.Add(new Binding("ZoomRate")
            {
                Source = m_staticValue
            });
            eNewTarget.SetBinding(Ellipse.WidthProperty, MBTargetR);
            eNewTarget.SetBinding(Ellipse.HeightProperty, MBTargetR);
            MultiBinding MBTargetCanvasLeft = new MultiBinding()
            {
                Converter = new TargetPosXConverter(targetUI.Target.PosX)
            };

            MBTargetCanvasLeft.Bindings.Add(new Binding("TargetRadius")
            {
                Source = m_staticValue
            });
            MBTargetCanvasLeft.Bindings.Add(new Binding("StuffConveyorOriginX")
            {
                Source = m_staticValue
            });
            MBTargetCanvasLeft.Bindings.Add(new Binding("ScreenRate")
            {
                Source = m_staticValue
            });
            MBTargetCanvasLeft.Bindings.Add(new Binding("ZoomRate")
            {
                Source = m_staticValue
            });
            eNewTarget.SetBinding(Canvas.LeftProperty, MBTargetCanvasLeft);
            MultiBinding MBTargetCanvasTop = new MultiBinding()
            {
                Converter = new TargetPosYConverter(targetUI.Target.PosY)
            };

            MBTargetCanvasTop.Bindings.Add(new Binding("TargetRadius")
            {
                Source = m_staticValue
            });
            MBTargetCanvasTop.Bindings.Add(new Binding("StuffConveyorOriginY")
            {
                Source = m_staticValue
            });
            MBTargetCanvasTop.Bindings.Add(new Binding("ScreenRate")
            {
                Source = m_staticValue
            });
            MBTargetCanvasTop.Bindings.Add(new Binding("ZoomRate")
            {
                Source = m_staticValue
            });
            eNewTarget.SetBinding(Canvas.TopProperty, MBTargetCanvasTop);
        }