Exemplo n.º 1
0
        public static void CenterShow(Panel pc, FrameworkElement fc)
        {
            if (!pc.Children.Contains(fc))
            {
                pc.Children.Add(fc);
            }
            double w, h;

            if (fc.Width > 0)
            {
                w = fc.Width;
            }
            else
            {
                w = fc.ActualWidth;
            }
            if (fc.Height > 0)
            {
                h = fc.Height;
            }
            else
            {
                h = fc.ActualHeight;
            }
            w = (pc.ActualWidth - w) / 2;
            h = (pc.ActualHeight - h) / 2;
            Canvas.SetLeft(fc, w);
            Canvas.SetTop(fc, h);

            ActionActive.Active(fc);
        }
Exemplo n.º 2
0
        public void MoveArea_PointerPressed(object sender, PointerRoutedEventArgs e)
        {
            if (_EnableH || _EnableV)
            {
                FrameworkElement item = sender as FrameworkElement;
                IsMove = true;
                //isMouseCaptured = true;

                //e.Handled = false;
                //UserControl uc = (UserControl)po.Parent;
                Canvas p = po.Parent as Canvas;
                ActionActive.Active(po);
                mouseVerticalPosition   = e.GetCurrentPoint(p).Position.Y;
                mouseHorizontalPosition = e.GetCurrentPoint(p).Position.X;
            }
        }
Exemplo n.º 3
0
        public static void Active(FrameworkElement o)
        {
            int z = ActionActive.getMaxZIndex(o);

            Canvas.SetZIndex(o, z + 1);
        }
Exemplo n.º 4
0
 public void ActiveWindow()
 {
     //LynxDesktop ld = LynxDesktop.FindLynxDesktop(this);
     //this.SetValue(Canvas.ZIndexProperty, ld.MaxZIndex++);
     ActionActive.Active(this);
 }
Exemplo n.º 5
0
        public void setArrow(Point SP, Point EP, double r, Color sc, Color ec, Color ForeColor)
        {
            double arc = -Math.Atan((EP.Y - SP.Y) / (EP.X - SP.X));
            bool   isR = true;

            if (EP.X - SP.X > 0)
            {
            }
            else
            {
                isR = false;
            }
            Point[] dp = new Point[7];
            dp[0] = new Point(SP.X + Math.Cos(Math.PI / 6 + arc) * r, SP.Y - Math.Sin(Math.PI / 6 + arc) * r);
            dp[6] = new Point(SP.X + Math.Cos(-Math.PI / 6 + arc) * r, SP.Y - Math.Sin(-Math.PI / 6 + arc) * r);
            dp[1] = new Point(EP.X + Math.Cos(Math.PI / 2 + arc) * r, EP.Y - Math.Sin(Math.PI / 2 + arc) * r);
            dp[2] = new Point(EP.X + Math.Cos(Math.PI / 2 + arc) * (r + r), EP.Y - Math.Sin(Math.PI / 2 + arc) * (r + r));
            if (isR)
            {
                dp[3] = new Point(EP.X - Math.Cos(Math.PI + arc) * (r + r), EP.Y + Math.Sin(Math.PI + arc) * (r + r));
            }
            else
            {
                dp[3] = new Point(EP.X + Math.Cos(Math.PI + arc) * (r + r), EP.Y - Math.Sin(Math.PI + arc) * (r + r));
            }
            dp[4] = new Point(EP.X + Math.Cos(-Math.PI / 2 + arc) * (r + r), EP.Y - Math.Sin(-Math.PI / 2 + arc) * (r + r));
            dp[5] = new Point(EP.X + Math.Cos(-Math.PI / 2 + arc) * r, EP.Y - Math.Sin(-Math.PI / 2 + arc) * r);

            if (DeskPanel.Children.Contains(DragArrow))
            {
                DeskPanel.Children.Remove(DragArrow);
            }
            DragArrow = new Path();
            PathGeometry pg = new PathGeometry();

            DragArrow.Data = pg;
            PathFigure pf = new PathFigure();

            pg.Figures.Add(pf);
            pf.StartPoint = dp[0];

            LineSegment l1 = new LineSegment();

            l1.Point = dp[1];
            LineSegment l2 = new LineSegment();

            l2.Point = dp[2];
            LineSegment l3 = new LineSegment();

            l3.Point = dp[3];
            LineSegment l4 = new LineSegment();

            l4.Point = dp[4];
            LineSegment l5 = new LineSegment();

            l5.Point = dp[5];
            LineSegment l6 = new LineSegment();

            l6.Point = dp[6];
            //LineSegment l7 = new LineSegment();
            //l7.Point=dp[0];
            ArcSegment a = new ArcSegment();

            a.Size = new Size(2 * r, 2 * r);
            if (isR)
            {
                a.SweepDirection = SweepDirection.Clockwise;
                a.IsLargeArc     = true;
            }
            else
            {
                a.SweepDirection = SweepDirection.Counterclockwise;
                a.IsLargeArc     = true;
            }

            a.Point = dp[0];

            pf.Segments.Add(l1);
            pf.Segments.Add(l2);
            pf.Segments.Add(l3);
            pf.Segments.Add(l4);
            pf.Segments.Add(l5);
            pf.Segments.Add(l6);
            //pf.Segments.Add(l7);
            pf.Segments.Add(a);

            LinearGradientBrush rb = new LinearGradientBrush();

            //rb.Center=PCenter;
            rb.MappingMode = BrushMappingMode.Absolute;
            rb.StartPoint  = SP;
            rb.EndPoint    = EP;
            //rb.GradientOrigin = PCenter;
            //rb.Center = PCenter;

            GradientStop gc = new GradientStop();

            gc.Color  = sc;
            gc.Offset = 0;
            GradientStop gc1 = new GradientStop();

            gc1.Color  = ec;
            gc1.Offset = 1;
            rb.GradientStops.Add(gc);
            rb.GradientStops.Add(gc1);

            DragArrow.Fill            = rb;
            DragArrow.Stroke          = new SolidColorBrush(ForeColor);
            DragArrow.StrokeThickness = 1;
            if (!DeskPanel.Children.Contains(DragArrow))
            {
                DeskPanel.Children.Add(DragArrow);
            }
            ActionActive.Active(DragArrow);
            //Canvas.SetZIndex(DragArrow, 100);
            //DrawCanvas.Children.Add(p);
            //return p;
        }