当前位置: 首页>>代码示例>>C#>>正文


C# Canvas.MoveTo方法代码示例

本文整理汇总了C#中System.Windows.Controls.Canvas.MoveTo方法的典型用法代码示例。如果您正苦于以下问题:C# Canvas.MoveTo方法的具体用法?C# Canvas.MoveTo怎么用?C# Canvas.MoveTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Controls.Canvas的用法示例。


在下文中一共展示了Canvas.MoveTo方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ApplicationCanvas

        public ApplicationCanvas()
        {
            //r.Fill = Brushes.Red;
            //r.AttachTo(this);
            //r.MoveTo(8, 8);
            //this.SizeChanged += (s, e) => r.SizeTo(this.Width - 16.0, this.Height - 16.0);

            var Scene = new Canvas().AttachTo(this);

            this.SizeChanged += (s, e) => Scene.MoveTo(this.Width / 2, this.Height / 2);

            var EgoSpeed = 0.5;
            var EgoPosition = 0.0;

            {
                var ego = new ski1();

                ego.AttachTo(Scene);

                (1000 / 60).AtIntervalWithCounter(
                    c =>
                    {
                        EgoPosition += EgoSpeed;

                        ego.MoveTo(0, (EgoPosition) % this.Height - this.Height / 2);
                    }
                );
            }

            Action<double, double> tree = (x, y) => new ski51().AttachTo(Scene).MoveTo(x, y);
            Action<double, double> deadtree = (x, y) => new ski50().AttachTo(Scene).MoveTo(x, y);
            Action<double, double> stone = (x, y) => new ski45().AttachTo(Scene).MoveTo(x, y);
            Action<double, double> stonefield = (x, y) => new ski27().AttachTo(Scene).MoveTo(x, y);

            tree(-64, 32);
            tree(64, 32);

            tree(-64, -32);
            tree(64, -32);

            var logo = new Avalon.Images.jsc().AttachTo(this);

            this.RotateScene =
                a =>
                {
                    Scene.RenderTransform = new RotateTransform(a);
                };

            RotateScene(12);

            this.Accelerate =
                (ax, ay, az) =>
                {
                    Scene.RenderTransform = new RotateTransform(ax * 90);

                    EgoSpeed = (1 - az) * 2;
                };
        }
开发者ID:BGCX261,项目名称:zproxygames-svn-to-git,代码行数:58,代码来源:ApplicationCanvas.cs

示例2: OrcasAvalonApplicationCanvas

        public OrcasAvalonApplicationCanvas()
        {
            Width = DefaultWidth;
            Height = DefaultHeight;
            //Background = 0xffc0c0c0.ToSolidColorBrush();
            Background = Brushes.Black;

            var InfoOverlay = new Canvas
            {
                Width = DefaultWidth,
                Height = DefaultHeight,
            };


            var InfoOverlayShadow = new Rectangle
            {
                Width = DefaultWidth,
                Height = DefaultHeight,
                Fill = Brushes.Black
            }.AttachTo(InfoOverlay);

            var InfoOverlayShadowOpacity = InfoOverlay.ToAnimatedOpacity();
            InfoOverlayShadowOpacity.Opacity = 1;

            var InfoOverlayText = new TextBox
            {
                AcceptsReturn = true,
                IsReadOnly = true,
                Background = Brushes.Transparent,
                BorderThickness = new Thickness(0),
                Width = DefaultWidth,
                Height = 180,
                TextAlignment = TextAlignment.Center,
                FontSize = 30,
                Foreground = Brushes.White,
                Text = "The winner is\n the first player\n to get an unbroken row\n of five stones",
                FontFamily = new FontFamily("Verdana")

            }.MoveTo(0, (DefaultHeight - 180) / 2).AttachTo(InfoOverlay);



            var TouchOverlay = new Canvas
            {
                Width = DefaultWidth,
                Height = DefaultHeight,
                Background = Brushes.Yellow,
                Opacity = 0,
            };



            var Tiles = new Tile[Intersections * Intersections];

            #region WhereUnderAttack
            Func<int, int, IEnumerable<Tile>> WhereUnderAttack =
                (length, value) =>
                    Tiles.Where(
                        k =>
                        {
                            if (k.Value != 0)
                                return false;


                            return k.IsUnderAttack(value, length);
                        }
                    );
            #endregion

            #region AI
            Action AI =
                delegate
                {
                    // defensive rule:

                    var AttackWith4 = WhereUnderAttack(4, -1).FirstOrDefault();
                    if (AttackWith4 != null)
                    {
                        Console.WriteLine("AttackWith4");
                        AttackWith4.Value = -1;
                        return;
                    }

                    var AttackedBy4 = WhereUnderAttack(4, 1).FirstOrDefault();
                    if (AttackedBy4 != null)
                    {
                        Console.WriteLine("AttackedBy4");
                        AttackedBy4.Value = -1;
                        return;
                    }

                    var AttackWith3 = WhereUnderAttack(3, -1).FirstOrDefault();
                    if (AttackWith3 != null)
                    {
                        Console.WriteLine("AttackWith3");
                        AttackWith3.Value = -1;
                        return;
                    }

                    var AttackedBy3 = WhereUnderAttack(3, 1).FirstOrDefault();
//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:OrcasAvalonApplicationCanvas.cs

示例3: OrcasAvalonApplicationCanvas

        public OrcasAvalonApplicationCanvas()
        {
            Width = DefaultWidth;
            Height = DefaultHeight;

            this.ClipToBounds = true;

            Colors.Blue.ToGradient(Colors.Black, DefaultHeight / 4).Select(
                (c, i) =>
                    new Rectangle
                    {
                        Fill = new SolidColorBrush(c),
                        Width = DefaultWidth,
                        Height = 5,
                    }.MoveTo(0, i * 4).AttachTo(this)
            ).ToArray();

            var mouse = new Image
            {
                Source = (KnownAssets.Path.Assets + "/mouse.png").ToSource(),
                Width = 32,
                Height = 32
            }.MoveTo(0, 0).AttachTo(this);

            var img = new Image
            {
                Source = (KnownAssets.Path.Assets + "/jsc.png").ToSource()
            }.MoveTo(DefaultWidth - 96, 0).AttachTo(this);

            var Content = new Canvas
            {
                Width = DefaultWidth,
                Height = DefaultHeight,

            }.AttachTo(this);

            var ContentY = new AnimatedDouble(0);

            ContentY.ValueChanged += y => Content.MoveTo(0, y);

            {
                var maze = new MazeGenerator(12, 8, null);
                var blocks = new BlockMaze(maze);
                var w = new BlockMaze(maze);
                Colors.Black.ToGradient(Colors.Yellow, 30).ForEach(
                    (c, i) =>
                        RenderMaze(60 + i * 0.1, w, new SolidColorBrush(c), Content)
                );
            }

            var TouchOverlay = new Rectangle
            {
                Fill = Brushes.Yellow,
                Opacity = 0,
                Width = DefaultWidth,
                Height = DefaultHeight
            }.AttachTo(this);

            TouchOverlay.MouseEnter +=
                delegate
                {
                    mouse.Show();
                };
            TouchOverlay.MouseLeave +=
                delegate
                {
                    mouse.Hide();
                };
            TouchOverlay.Cursor = Cursors.None;
            TouchOverlay.MouseMove +=
                (s, args) =>
                {
                    var p = args.GetPosition(this);

                    mouse.MoveTo(p.X - 4, p.Y - 4);
                };

            TouchOverlay.MouseLeftButtonUp +=
                (s, args) =>
                {
                    var p = args.GetPosition(this);

                    ShowExplosion(Convert.ToInt32(p.X), Convert.ToInt32(p.Y), Content);
                    ("assets/AvalonMouseMaze/explosion.mp3").PlaySound();
                    150.AtDelay(
                        delegate
                        {
                            ShowExplosion(Convert.ToInt32(p.X + 6), Convert.ToInt32(p.Y - 6), Content);
                        }
                    );

                    300.AtDelay(
                        delegate
                        {
                            ShowExplosion(Convert.ToInt32(p.X + 4), Convert.ToInt32(p.Y + 6), Content);

                            ContentY.SetTarget(DefaultHeight);
                        }
                    );

//.........这里部分代码省略.........
开发者ID:BGCX261,项目名称:zproxygames-svn-to-git,代码行数:101,代码来源:OrcasAvalonApplicationCanvas.cs

示例4: ApplicationCanvas

        public ApplicationCanvas()
        {

            var Container720X = new Canvas().AttachTo(this);

            Container720 = new Canvas().AttachTo(Container720X);
            //Container720A = Container720.ToAnimatedOpacity();

            i = new Avalon.Images.Promotion3D_controller_720p();
            i.AttachTo(Container720);
            iA = i.ToAnimatedOpacity();
            iA.Opacity = 0.8;

            var ShadowOverlay = new Rectangle { Fill = Brushes.Black };
            var ShadowOverlayA = ShadowOverlay.ToAnimatedOpacity();


            ShadowOverlay.AttachTo(Container720);
            ShadowOverlay.SizeTo(1280, 720);

            ii = new Avalon.Images.Promotion3D_controller_android_720();
            ii.AttachTo(Container720);
            var iiA = ii.ToAnimatedOpacity();


            var Title = new Avalon.Images.Title();
            Title.AttachTo(Container720X);





            this.SizeChanged += (s, e) =>
            {
                Container720X.MoveTo(
                        (this.Width - 1280) / 2,
                    (this.Height - 720) / 2
                );


                Console.WriteLine(new { this.Width, this.Height });


            };

            enter = new Avalon.Images.start
            {
                Cursor = Cursors.Hand
            }.AttachTo(this);

            entero = enter.ToAnimatedOpacity();


            this.SizeChanged += (s, e) => enter.MoveTo(
                (this.Width - 128) * 0.8 + 64,
                (this.Height - 128) / 2 + 32);

            #region Black
            {
                Rectangle r = new Rectangle();
                r.Fill = Brushes.Black;
                r.AttachTo(this);
                r.MoveTo(0, 0);

                this.SizeChanged += (s, e) =>
                {
                    r.Width = this.Width;
                    r.Height = ((this.Height - 720) / 2).Max(0);
                };
            }

            {
                Rectangle r = new Rectangle();
                r.Fill = Brushes.Black;
                r.AttachTo(this);
                r.MoveTo(0, 0);

                this.SizeChanged += (s, e) =>
                {
                    r.Width = this.Width;

                    //                NotImplementedException
                    //at ScriptCoreLib.ActionScript.BCLImplementation.System.Windows::__UIElement/InternalGetHeight_100663344()
                    //at ScriptCoreLib.ActionScript.BCLImplementation.System.Windows::__UIElement/VirtualGetHeight_100663342()
                    //at ScriptCoreLib.ActionScript.BCLImplementation.System.Windows::__FrameworkElement/get Height()

                    var Height = ((this.Height - 720) / 2).Max(0);

                    r.Height = Height;
                    r.MoveTo(0, this.Height - Height);
                };
            }
            #endregion

            var hotzone = new Rectangle { Fill = Brushes.Green, Opacity = 0 }.AttachTo(Container720X);

            hotzone.Cursor = Cursors.Hand;

            hotzone.MoveTo(1280 / 3, 720 * 2 / 3);
            hotzone.SizeTo(1280 / 3, 720 / 3);
//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:ApplicationCanvas.cs

示例5: ApplicationCanvas

        public ApplicationCanvas()
        {
            {
                var r = new Rectangle();
                r.Fill = Brushes.Black;
                r.AttachTo(this);
                r.MoveTo(0, 0);
                r.Opacity = 0.9;
                this.SizeChanged += (s, e) => r.SizeTo(this.Width, this.Height / 2);
            }

            {
                var r = new Rectangle();
                r.Fill = Brushes.Black;
                r.AttachTo(this);

                this.SizeChanged += (s, e) => r.MoveTo(0, this.Height / 2).SizeTo(this.Width, this.Height / 2);
            }

            var VocabularyLines = Vocabulary.Trim().Split('\n');

            var v = VocabularyLines.Select(
                k =>
                {
                    var verbs = k.Split(':');

                    return new { A = verbs[0].Trim(), B = verbs[1].Trim() };
                }
            ).Randomize().AsCyclicEnumerator();


            var az = 0.5;
            var ax = 0.0;

            var ABCanvas = new Canvas().AttachTo(this);

            var A = new TextBox
            {
                BorderThickness = new Thickness(0),
                Background = Brushes.Transparent,
                TextAlignment = System.Windows.TextAlignment.Center,
                Foreground = Brushes.White,
                Text = "suur ettevõte",
                IsReadOnly = true,
                FontSize = 70
            };

            A.AttachTo(ABCanvas);

            var B = new TextBox
            {
                BorderThickness = new Thickness(0),
                Background = Brushes.Transparent,
                TextAlignment = System.Windows.TextAlignment.Center,
                Foreground = Brushes.White,
                Text = "large-scale enterprise",
                IsReadOnly = true,
                FontSize = 70
            };

            var MoveNextDisabled = false;
            Action MoveNext = delegate
            {
                if (MoveNextDisabled)
                    return;

                MoveNextDisabled = true;
                v.MoveNext();
                A.Text = v.Current.A;
                B.Text = v.Current.B;

                600.AtDelay(() => MoveNextDisabled = false);
            };

            MoveNext();

            B.AttachTo(ABCanvas);
            B.MoveTo(0, 64);

            Action Update =
                delegate
                {
          

                    if (Math.Abs(ax) > 0.4)
                        MoveNext();

                    az = Math.Min(1, az);
                    az = Math.Max(0, az);

                    var max = this.Height / 6;
                    var min = this.Height / 3;

                    // az = 1 is 0 degrees
                    // az = 0 is 90 degrees

                    az = 1 - az;

                    az -= 0.05;
                    az *= 10;
//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:ApplicationCanvas.cs

示例6: CreateWindow

        public void CreateWindow(Position WindowLocation, Action<WindowInfo> Yield = null)
        {
            var GlassArea = new Canvas();

            GlassArea.AttachTo(this);
            GlassArea.MoveTo(WindowLocation.Left, WindowLocation.Top);
            GlassArea.SizeTo(WindowLocation.Width, WindowLocation.Height);
            GlassArea.ClipToBounds = true;

            for (int i = 0; i < WindowLocation.Width; i += 456)
                for (int j = 0; j < WindowLocation.Height; j += 696)
                {
                    var i2 = new Avalon.Images.s_bg().SizeTo(456, 696);

                    i2.MoveTo(i, j);
                    i2.Opacity = 0.8;

                    i2.AttachTo(GlassArea);
                }

            var GlassOpacity = GlassArea.ToAnimatedOpacity();

            GlassOpacity.Opacity = 1;
            var w = new WindowInfo { GlassArea = GlassArea, GlassOpacity = GlassOpacity, WindowLocation = WindowLocation };


            var Left = new Avalon.Images.s_l
            {
                Stretch = Stretch.Fill
            }
            .AttachTo(this);


            var Top = new Avalon.Images.s_t
            {
                Stretch = Stretch.Fill
            }
            .AttachTo(this);




            var Right = new Avalon.Images.s_r
            {
                Stretch = Stretch.Fill
            }.AttachTo(this);




            var Bottom = new Avalon.Images.s_b
            {
                Stretch = Stretch.Fill
            }
             .AttachTo(this);


            var TopLeft = new Avalon.Images.s_tl
            {
                Stretch = Stretch.Fill
            }
           .AttachTo(this);


            var BottomRight = new Avalon.Images.s_br
            {
                Stretch = Stretch.Fill
            }
             .AttachTo(this);



            var TopRight = new Avalon.Images.s_tr
            {
                Stretch = Stretch.Fill
            }
           .AttachTo(this);


            var BottomLeft = new Avalon.Images.s_bl
            {
                Stretch = Stretch.Fill
            }
           .AttachTo(this);


            w.WindowLocationChanged +=
               delegate
               {
                   Left.MoveTo(WindowLocation.Left - 16, WindowLocation.Top + 6)
                   .SizeTo(16, WindowLocation.Height - 6 - 4);

                   Top.MoveTo(WindowLocation.Left + 6, WindowLocation.Top - 16)
          .SizeTo(WindowLocation.Width - 6 - 4, 22);

                   Right.MoveTo(WindowLocation.Left + WindowLocation.Width, WindowLocation.Top + 6)
               .SizeTo(20, WindowLocation.Height - 4 - 6);


                   Bottom.MoveTo(WindowLocation.Left + 5, WindowLocation.Top + WindowLocation.Height)
//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:ApplicationCanvas.cs

示例7: ApplicationCanvas

        public ApplicationCanvas()
        {
            //return;

            Background = Brushes.Black;

            var OverlayWhite = new Rectangle
            {
                Fill = Brushes.White
            }.AttachTo(this);

            this.Overlay = new Rectangle
            {
                Fill = Brushes.Black
            }.AttachTo(this);

            var c = new Canvas().AttachTo(this);

            this.SizeChanged +=
                (s, e) =>
                {
                    //Console.WriteLine(new { Width, Height, this.ActualWidth, this.ActualHeight });
                    OverlayWhite.SizeTo(
                        this.Width,
                        this.Height
                    );
                    Overlay.SizeTo(
                        this.Width,
                        this.Height
                    );

                    c.MoveTo(
                        this.Width * 0.5,
                        this.Height * 0.5
                    );
                };

            Func<double, double, Image> f =
                (o, x) =>
                {
                    return new white_jsc
                    {
                        Opacity = o
                    }.AttachTo(c).MoveTo(
                        white_jsc.ImageDefaultWidth / -2 + x,
                        white_jsc.ImageDefaultHeight / -2
                    );
                };

            var a = new List<Action<bool>>();

            var ss = 640;
            var ia = 1;


            for (int i = -ss; i <= 0; i += ia)
            {
                ia += 2;

                {
                    var o = (ss + i + 64) / (double)(ss + 64);
                    var l = f(o, -i);
                    var r = f(o, i);

                    Action<bool> j =
                        n =>
                        {
                            l.Show(n);
                            r.Show(n);
                        };
                    j(false);
                    a.Add(j);
                }
            }



            {
                var l = f(1, 0);

                l.Hide();
                Action<bool> j =
                    n =>
                    {
                        if (n)
                        {
                            Overlay.Fill = Brushes.White;
                            l.Show();
                            return;
                        }

                        15.AtDelay(
                            delegate
                            {
                                Overlay.Fill = Brushes.Black;
                            }
                        );

                        Action<int, int, int> ShakeAt = null;

//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:ApplicationCanvas.cs

示例8: ExtendedField

        public ExtendedField(int SizeX, int SizeY, int Width, int Height)
        {
            this.Container = new Canvas
            {
                Width = Width,
                Height = Height
            };

            this.Container.ClipTo(0, 0, Width, Height);

            this.Field = new Field(SizeX, SizeY);

            this.Field.Container.AttachTo(this.Container);

            #region interactive layers
            var CurrentTileCanvas = new Canvas
            {
                Width = this.Field.Tiles.Width,
                Height = this.Field.Tiles.Height
            }.AttachTo(this.Container);

            var ExplosionCanvas = new Canvas
            {
                Width = Width,
                Height = Height
            }.AttachTo(this.Container);

            var InfoOverlay = new Canvas
            {
                Width = Width,
                Height = Height
            }.AttachTo(this.Container);

            this.Field.InfoOverlay.AttachTo(InfoOverlay);

            double CurrentTileX = 0;
            double CurrentTileY = 0;

            var CurrentTile = default(SimplePipe);

            // SimplePipe.BuildablePipes.Random()();

            this.GetPipeToBeBuilt = () => CurrentTile;

            this.SetPipeToBeBuilt =
                value =>
                {
                    if (CurrentTile != null)
                    {
                        CurrentTile.OverlayBlackAnimationStop();
                        CurrentTile.Container.Orphanize();
                        CurrentTile.Container.Opacity = 1;
                    }

                    CurrentTile = value;

                    if (CurrentTile != null)
                    {
                        CurrentTile.Container.Opacity = 0.7;
                        CurrentTile.Container.MoveTo(CurrentTileX, CurrentTileY);
                        CurrentTile.Container.AttachTo(CurrentTileCanvas);
                        CurrentTile.OverlayBlackAnimationStart();
                    }
                };

            #endregion

            #region overlay
            this.Overlay = new Canvas
            {
                Width = Width,
                Height = Height
            };

            var OverlayRectangle = new Rectangle
            {
                Fill = Brushes.Black,
                Width = Width,
                Height = Height,
                Opacity = 0
            }.AttachTo(Overlay);

            this.Field.Tiles.Overlay.AttachTo(Overlay);
            #endregion

            #region move the map with the mouse yet not too often anf smooth enough

            #region MoveTo
            Action<int, int> MoveTo = NumericEmitter.Of(
                (x, y) =>
                {
                    this.Field.Tiles.Overlay.MoveTo(x, y);
                    this.Field.Container.MoveTo(x, y);

                    CurrentTileCanvas.MoveTo(x, y);
                    ExplosionCanvas.MoveTo(x, y);
                    InfoOverlay.MoveTo(x, y);
                }
            );
            #endregion
//.........这里部分代码省略.........
开发者ID:skdhayal,项目名称:avalonpipemania,代码行数:101,代码来源:ExtendedField.cs

示例9: AvalonMinesweeperCanvas


//.........这里部分代码省略.........

            this.MouseLeftButtonDown +=
                (sender, key_args) =>
                {
                    this.Focus();
                };

            #endregion

            var TouchOverlay = new Canvas
            {
                Width = ContentWidth,
                Height = ContentHeight,
            }.AttachTo(this);

            var TouchOverlayTrap = new Rectangle
            {
                Fill = Brushes.Red,
                Width = ContentWidth,
                Height = ContentHeight,
                Opacity = 0
            }.AttachTo(TouchOverlay);
            #endregion

            var clone = new NamedArrowCursorControl
            {
                Text = "player revived!"
            }.AttachContainerTo(InfoOverlay);

            clone.Hide();

            var shadowoffset = 4;

            this.Content.MoveTo(-DefaultWidth / 2, -DefaultHeight / 2);
            TouchOverlay.MoveTo(-DefaultWidth / 2, -DefaultHeight / 2);

            // the button shall be atteched to the playfield with the following rules
            var MineFieldButtons = new BindingList<MineFieldButton>().WithEvents(
                k =>
                {
                    var x = (ContentWidth / 2) + (k.IndexX * MineFieldButton.Size);
                    var y = (ContentHeight / 2) + (k.IndexY * MineFieldButton.Size);

                    k.Shadow.MoveTo(x + shadowoffset, y + shadowoffset).AttachTo(Shadows);
                    k.MoveContainerTo(x, y).AttachContainerTo(Visuals);
                    k.TouchRectangle.MoveTo(x, y).AttachTo(TouchOverlay);

                    return delegate
                    {
                        k.Shadow.Orphanize();
                        k.OrphanizeContainer();
                        k.TouchRectangle.Orphanize();
                    };
                }
            );

            Action HideCursor =
                delegate
                {
                    TouchOverlay.Cursor = Cursors.None;
                    MineFieldButtons.Source.ForEach(k => k.TouchRectangle.Cursor = Cursors.None);
                };

            Action ShowCursor =
                delegate
                {
开发者ID:BGCX261,项目名称:zproxygames-svn-to-git,代码行数:67,代码来源:AvalonMinesweeperCanvas.cs

示例10: SimpleCarouselControl

        public SimpleCarouselControl(int DefaultWidth, int DefaultHeight)
        {
            this.Container = new Canvas
            {
                Width = DefaultWidth,
                Height = DefaultHeight
            };

            var ContentContainer = new Canvas
            {
                Width = DefaultWidth,
                Height = DefaultHeight
            }.AttachTo(this.Container);

            this.Caption = new TextBox
            {
                Width = DefaultWidth,
                Height = 32,
                TextAlignment = TextAlignment.Center,
                Foreground = Brushes.White,
                BorderThickness = new Thickness(0),
                Background = Brushes.Transparent,
                IsReadOnly = true
            }.MoveTo(0, (DefaultHeight - 32) / 2).AttachTo(this.Container);

            this.Overlay = new Canvas
            {
                Width = DefaultWidth,
                Height = DefaultHeight,
            };

            var OverlayFill = new Rectangle
            {
                Width = DefaultWidth,
                Height = DefaultHeight,
                Fill = Brushes.Red,
                Opacity = 0
            }.AttachTo(this.Overlay);

            var a = new List<Entry>();

            var OverlayReorderingEnabled = true;

            #region Timer
            this.Timer = (1000 / 30).AtInterval(
                delegate
                {
                    a.ForEach(k => k.Tick());

                    a.OrderBy(k => k.cy).ForEach(
                        k =>
                        {

                            if (OverlayReorderingEnabled)
                            {
                                // in javascript reordering an element under mouse
                                // will leave you without the leave event
                                // we could sort other nodes around it tho

                                k.Overlay.Orphanize();
                                k.Overlay.AttachTo(this.Overlay);
                            }

                            k.pc.Orphanize();
                            k.pc.AttachTo(this.Container);

                        }
                    );
                }
            );
            #endregion


            var s = 0.01;

            this.AddEntry =
                e =>
                {
                    var pc_Width = 166 + 9;
                    var pc_Height = 90 + 9 * 2;

                    var pc = new Canvas
                    {
                        //Background = Brushes.Green,
                        Width = pc_Width,
                        Height = pc_Height
                    }.AttachTo(ContentContainer);

                    const string Assets = "assets/ScriptCoreLib.Avalon.Carousel";

                    var p = new Image
                    {
                        Width = 166,
                        Height = 90,
                        Stretch = Stretch.Fill,
                        Source = (Assets + "/PreviewShadow.png").ToSource()
                    }.AttachTo(pc);


                    var ps = new Image
//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:SimpleCarouselControl.cs

示例11: ApplicationCanvas

        public ApplicationCanvas()
        {
            Width = DefaultWidth;
            Height = DefaultHeight;


            this.Background = Brushes.Blue;

            var left = new PartialView(Colors.Blue, true).AttachTo(this);
            var right = new PartialView(Colors.Green).AttachTo(this).MoveTo(DefaultWidth / 2, 0);

            this.InfoOverlay = new Canvas().AttachTo(this);

            this.About = new TextBox
            {
                BorderThickness = new Thickness(0),
                Background = Brushes.Transparent,
                Foreground = Brushes.Black,
                AcceptsReturn = true,

                Text =

@"Windows Presentation Foundation Touch demo
- Debuggable under .NET (fullscreen when maximized and touch events)
- Adobe Flash 10.1 version via jsc
     No touch events in fullscreen
     Browser fullscreen feature shall be used instead
     Tested for IE, Firefox, Chrome

- Javascript version for Firefox4 via jsc
- Tested with 4 touch points on Dell Latitude XT
- Galaxy S/ Galaxy Tab within browser have only 1 touchpoint
- 2012.09 flash no longer available on android
- multitouch seems to work in firefox/ flash (11.0)
- multitouch seems to work in ie/flash (10.0)
- p2p LAN no longer works?
- Works on AIR for Android! :) 2013-03-05
- Works on AIR for iPad! :) 2014-03-01
"


            }.AttachTo(InfoOverlay).MoveTo(128, 32);

            var c1 = new cloud_mid().AttachTo(InfoOverlay);
            var c2 = new cloud_mid().AttachTo(InfoOverlay);


            this.TouchOverlay = new Canvas
            {



            }.AttachTo(this); //.SizeTo(DefaultWidth, DefaultHeight);

            var TouchArea = new Rectangle
            {
                Width = DefaultWidth,
                Height = DefaultHeight,
                Fill = Brushes.White,
                Opacity = 0
            }.AttachTo(TouchOverlay);


            var t = TouchOverlay.ToTouchEvents(
                m =>
                {
                    // a new reusable finger introduced by the system!
                    var Content = new Canvas();

                    new Avalon.Images.white_jsc().AttachTo(Content).MoveTo(
                        Avalon.Images.white_jsc.ImageDefaultWidth / -2,
                        Avalon.Images.white_jsc.ImageDefaultHeight / -2
                    );

                    var CurrentTouchPoint = default(Tuple<double, double>);

                    Func<Tuple<double, double>> GetTouchPoint = () => CurrentTouchPoint;

                    m.TouchDown += e =>
                    {
                        var p = e.GetTouchPoint(TouchOverlay).Position;

                        CurrentTouchPoint = Tuple.Create(p.X, p.Y);
                        Content.AttachTo(InfoOverlay);
                    };

                    m.TouchUp += e =>
                    {
                        CurrentTouchPoint = null;
                        Content.Orphanize();
                    };

                    m.TouchMove += e =>
                    {
                        var p = e.GetTouchPoint(TouchOverlay).Position;

                        CurrentTouchPoint = Tuple.Create(p.X, p.Y);



//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:ApplicationCanvas.cs

示例12: BrowserAvalonExampleCanvas

		public BrowserAvalonExampleCanvas()
		{
			// jsc:javascript does not work well with structs
			this.Cursor = Cursors.None;

			this.Width = DefaultWidth;
			this.Height = DefaultHeight;

			new Rectangle
			{
				Fill = 0xff3D87FF.ToSolidColorBrush(),
				Width = DefaultWidth,
				Height = DefaultHeight / 2
			}.AttachTo(this).MoveTo(0, 0);

			new Rectangle
			{
				Fill = 0xff72BC3E.ToSolidColorBrush(),
				Width = DefaultWidth,
				Height = DefaultHeight / 2
			}.AttachTo(this).MoveTo(0, DefaultHeight / 2);


			new Rectangle
			{
				Fill = Brushes.GreenYellow,
				Width = 62,
				Height = 62
			}.AttachTo(this).MoveTo(32, 8);

			new Image
			{
				Source = "assets/BrowserAvalonExample.Assets/ground.png".ToSource()
			}.AttachTo(this).MoveTo(0, 160);

			new Image
			{
				Source = "assets/BrowserAvalonExample.Assets/shadowtop.png".ToSource(),
				Stretch = Stretch.Fill,
				Width = DefaultWidth,
				Height = 64
			}.AttachTo(this).MoveTo(0, 160);

			new Image
			{
				Source = "assets/BrowserAvalonExample.Assets/gradientwhite.png".ToSource(),
				Stretch = Stretch.Fill,
				Width = DefaultWidth,
				Height = 64
			}.AttachTo(this).MoveTo(0, 160 - 64);


			var info = new TextBox
			{
				Text = "hello world",
				Background = Brushes.Transparent,
				BorderThickness = new Thickness(0),
				IsReadOnly = true
			}.AttachTo(this).MoveTo(32, 32);

			var e = new Image 
			{
				Source = "assets/BrowserAvalonExample.Assets/tipsi2.png".ToSource()
			}.AttachTo(this).MoveTo(4, 5);

			var underlay = new Canvas
			{
				Width = DefaultWidth,
				Height = DefaultHeight,

			}.AttachTo(this);

			 new Image
			{
				Source = "assets/BrowserAvalonExample.Assets/shadowtop.png".ToSource(),
				Stretch = Stretch.Fill,
				Width = DefaultWidth,
				Height = 64
			}.AttachTo(this).MoveTo(0, 0);

			 var cursor = new Canvas
			 {
			 }.AttachTo(this).MoveTo(4, 5);

			var arrow = new Image
			{
				Source = "assets/BrowserAvalonExample.Assets/arrow.png".ToSource()
			}.AttachTo(cursor).MoveTo(-16, -16);

			var bluearrow = new Image
			{
				Source = "assets/BrowserAvalonExample.Assets/bluearrow.png".ToSource()
			}.AttachTo(cursor).MoveTo(-16, -16);


			bluearrow.Visibility = Visibility.Hidden;



			Action<double, double> DrawBrush =
//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:BrowserAvalonExampleCanvas.cs

示例13: ApplicationCanvas

        public ApplicationCanvas()
        {
            var c = new CheckBox
            {
                Content = new TextBlock { Text = "Print to Console  " }
            }.MoveTo(8, 96);


            var t = new TextBlock { Text = "?" }.AttachTo(this);

            var redblockcontainer = new Canvas();

            redblockcontainer.Opacity = 0.8;
            redblockcontainer.Background = Brushes.Red;
            redblockcontainer.AttachTo(this);
            redblockcontainer.MoveTo(8, 8);
            this.SizeChanged += (s, e) => redblockcontainer.MoveTo(64 - 16, this.Height / 3 - 16).SizeTo(this.Width - 96, this.Height / 3 - 8);

            var redblockoverlay = new Canvas();

            redblockoverlay.Opacity = 0.1;
            redblockoverlay.Background = Brushes.Red;
            redblockoverlay.AttachTo(this);
            redblockoverlay.MoveTo(8, 8);
            this.SizeChanged += (s, e) => redblockoverlay.MoveTo(64 + 64, this.Height / 3).SizeTo(this.Width - 96 - 64, this.Height / 3 - 8);

            var yellowblock = new Canvas();
            yellowblock.Opacity = 0.7;
            yellowblock.Background = Brushes.Yellow;
            yellowblock.AttachTo(this);
            yellowblock.SizeTo(400, 200);


            var a_case1 = Enumerable.Range(0, 64).Select(
              i =>
              {
                  var rr = new Rectangle();
                  rr.Fill = Brushes.Blue;
                  rr.AttachTo(yellowblock);
                  rr.SizeTo(32, 32);
                  rr.MoveTo(-32, -32);
                  return rr;
              }
          ).ToArray();


            var a_case2 = Enumerable.Range(0, 64).Select(
              i =>
              {
                  var rr = new Rectangle();
                  rr.Fill = Brushes.Green;
                  rr.AttachTo(this);
                  rr.SizeTo(32, 32);
                  rr.MoveTo(-32, -32);
                  return rr;
              }
          ).ToArray();


            var greenblock = new Canvas();
            greenblock.Opacity = 0.5;
            greenblock.Background = Brushes.Green;
            greenblock.AttachTo(this);
            greenblock.SizeTo(400, 200);
            greenblock.MoveTo(200 - 12, 12);

            var a_case3 = Enumerable.Range(0, 64).Select(
              i =>
              {
                  var rr = new Rectangle();
                  rr.Fill = Brushes.Black;
                  rr.AttachTo(redblockcontainer);
                  rr.SizeTo(32, 32);
                  rr.MoveTo(-32, -32);
                  return rr;
              }
          ).ToArray();



            var case1 = yellowblock;
            var case2 = greenblock;
            var case3 = redblockoverlay;

            #region case1
            case1.TouchDown +=
                (s, e) =>
                {
                    e.Handled = true;
                    // is called implicitly on Android Chrome
                    e.TouchDevice.Capture(case1);

                    Console.WriteLine("TouchDown");
                };

            case1.MouseMove +=
            (s, e) =>
            {
                // case 1
                var p = e.GetPosition(case1);
//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:ApplicationCanvas.cs


注:本文中的System.Windows.Controls.Canvas.MoveTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。