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


C# TextBox.AttachTo方法代码示例

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


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

示例1: ApplicationCanvas

        public ApplicationCanvas()
        {
            // X:\jsc.svn\examples\javascript\Test\TestShadowIFrame\TestShadowIFrame\Application.cs

            // could we use Foo.xaml?
            // see also http://caniuse.com/shadowdom
            // http://jonrimmer.github.io/are-we-componentized-yet/
            // https://bugzilla.mozilla.org/show_bug.cgi?id=811542

            // would we be able to use shadow dom to be able to activate file:// code?


            var t = new TextBox { Width = 200, Text = "hello" };
            Canvas.SetTop(t, 30);

            t.AttachTo(this);


            var bu = new Button { Content = "multiline" }.AttachTo(this);

            bu.Click +=
                delegate
            {
                t.AcceptsReturn = true;
                t.Height = 200;

            };
        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:28,代码来源:ApplicationCanvas.cs

示例2: ApplicationCanvas

        public ApplicationCanvas()
        {
            //var logo = new JSCSolutionsNETImage();
            //logo.AttachTo(this);
            var text = new TextBox
            {
                AcceptsReturn = true,
                BorderThickness = new Thickness(0),
                Background = Brushes.Transparent,
                Foreground = Brushes.Blue,
            };
            text.AttachTo(this);


            r.Fill = Brushes.Yellow;
            r.Opacity = 0.3;
            r.AttachTo(this);
            r.MoveTo(8, 8);

            this.SizeChanged += (s, e) =>
            {
                r.SizeTo(this.Width - 16, this.Height - 16);

                //logo.MoveTo(
                //    this.Width - logo.Width,
                //    this.Height - logo.Height
                //);
            };

            r.MouseEnter +=
                (s, e) =>
                {
                    text.Show();
                };

            r.MouseLeave +=
                (s, e) =>
                {
                    text.Hide();
                };


            r.MouseMove +=
                (s, e) =>
                {
                    var p = e.GetPosition(this);

                    text.Text = "jsc-solutions.net\n" + new { p.X, p.Y };

                    text.MoveTo(p.X + 32, p.Y);
                };
        }
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:52,代码来源:ApplicationCanvas.cs

示例3: 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

示例4: ApplicationCanvas

        public ApplicationCanvas()
        {
            this.Background = Brushes.Red;

            r.Fill = Brushes.White;
            r.AttachTo(this);
            r.MoveTo(4, 4);

            this.SizeChanged += (s, e) => r.SizeTo(this.Width - 8.0, this.Height - 8.0);

            {
                var ego = new ski1();

                ego.AttachTo(this).MoveTo(164, 96);

                (1000 / 60).AtIntervalWithCounter(
                    c =>
                    {
                        ego.MoveTo(164, c % this.Height);
                    }
                );
            }

            {
                var ego = new ski1();

                var dc = -64;

                ego.AttachTo(this).MoveTo(320, dc);

                (1000 / 60).AtIntervalWithCounter(
                    c =>
                    {
                        ego.MoveTo(320, (c + dc) % this.Height);
                    }
                );
            }

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

            tree(64, 32);

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

            this.SizeChanged += (s, e) => logo.MoveTo(this.Width - logo.Width, this.Height - logo.Height);

            this.MouseLeftButtonUp +=
                (s, a) =>
                {
                    var pos = a.GetPosition(this);

                    var f = new[] {
                        tree,
                        tree,
                        tree,
                        tree,
                        deadtree,
                        deadtree,
                        stone,
                        stone,
                        stone,
                        stonefield };

                    f.Random()(pos.X, pos.Y);
                };

            var t = new TextBox
            {
                Text = "ski",
                Background = Brushes.Transparent,
                BorderThickness = new Thickness(0)
            };

            t.AttachTo(this).MoveTo(96, 8);

            var ax = 0.0;
            var ay = 0.0;
            var az = 0.0;

            Action SizeChangedOrAccelerated =
                delegate
                {
                    t.Text = "ski: " + new { this.Width, this.Height, ax, ay, az };
                };

            this.SizeChanged += (s, e) => { SizeChangedOrAccelerated(); };

            t2.AttachTo(this).MoveTo(96, 24);

            Accelerate =
                (_ax, _ay, _az) =>
                {
                    ax = _ax;
                    ay = _ay;
                    az = _az;

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

示例5: Main


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

                        //if (w.WindowState == WindowState.Maximized)
                        //{
                        //    ss2 = s;
                        //}

                        var qw = w.ActualWidth - ss * 2;
                        var qh = w.ActualHeight - ss * 2;



                        wcam.MoveTo(w.Left + ss + ss2, w.Top + (w.ActualHeight - qh * ThumbnailSize - ss) - ss2).SizeTo(qw * ThumbnailSize, qh * ThumbnailSize);

                    }


                };
            #endregion


            w.LocationChanged +=
                delegate
                {
                    UpdateChildren();
                };



            var Borders = Enumerable.Range(1, s * 2).Reverse().Select(
                Width =>
                new
                {
                    Width = Width * 2,
                    Left = new Rectangle { Fill = Brushes.Black, Opacity = 0.06 }.MoveTo(0, 0).AttachTo(winfoc),
                    Right = new Rectangle { Fill = Brushes.Black, Opacity = 0.06 }.MoveTo(0, 0).AttachTo(winfoc),
                    Bottom = new Rectangle { Fill = Brushes.Black, Opacity = 0.03 }.MoveTo(0, 0).AttachTo(winfoc),
                    Top = new Rectangle { Fill = Brushes.Black, Opacity = 0.11 }.MoveTo(0, 0).AttachTo(winfoc)
                }
            ).ToArray();

            var CaptionBackgroundOverlay = new Rectangle
            {
                Fill = Brushes.Black,
                Opacity = 0.02,
            }.AttachTo(cc);

            var CaptionSysMenuOverlay = new Rectangle
            {
                Fill = Brushes.Black,
                Opacity = 0.02,
            }.AttachTo(cc).SizeTo(CaptionBackgroundHeight * 4, CaptionBackgroundHeight);

            var ExtraBorderTop = new Rectangle
            {
                Fill = Brushes.Black,
                Opacity = 0.0,
            }.AttachTo(winfoc);

            var ExtraBorderBottom = new Rectangle
            {
                Fill = Brushes.Black,
                Opacity = 0.0,
            }.AttachTo(winfoc);

            var CaptionClose = new TextBox
            {
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:67,代码来源:Program.cs

示例6: AvalonQueryExampleCanvas

		public AvalonQueryExampleCanvas()
		{
			CheckIsPanel();

			Width = DefaultWidth;
			Height = DefaultHeight;

			#region Gradient
			for (int i = 0; i < DefaultHeight; i += 4)
			{
				new Rectangle
				{
					Fill = ((uint)(0xff00007F + Convert.ToInt32(128 * i / DefaultHeight))).ToSolidColorBrush(),
					Width = DefaultWidth,
					Height = 5,
				}.MoveTo(0, i).AttachTo(this);
			}
			#endregion

			new Image
			{
				Source = "assets/FlashAvalonQueryExample/labels.png".ToSource()
			}.MoveTo(0, 0).AttachTo(this);

			//var FaciconService = "http://www.google.com/s2/favicons?domain=";

			// http://www.google.com/s2/favicons?domain=wordpress.com
			var KnownDomains = "63/155262375_104aee1bb0, 3183/2825405970_a1469cd673, 2336/2454679206_de5176b827, 3178/2825551196_6548ff54b9";
			var KnownFilter = "31";

			Func<Brush> Color_Inactive = () => 0xffc0c0c0.ToSolidColorBrush();
			Func<Brush> Color_Active = () => 0xffffffff.ToSolidColorBrush();
			Func<Brush> Color_Error = () => 0xffffff80.ToSolidColorBrush();

			var KnownDomainsInputHeight = 100;

			var KnownDomainsInput = new TextBox
			{
				AcceptsReturn = true,
				FontSize = 15,
				Text = KnownDomains,
				BorderThickness = new Thickness(0),
				//Foreground = 0xffffffff.ToSolidColorBrush(),
				Background = Color_Inactive(),
				Width = 400,
				Height = KnownDomainsInputHeight,
				TextWrapping = TextWrapping.Wrap
			}.MoveTo(32, 32).AttachTo(this);

			KnownDomainsInput.Orphanize();
			KnownDomainsInput.AttachTo(this);

			Action<TextBox> ApplyActiveColor =
				e =>
				{
					e.GotFocus +=
						delegate
						{
							e.Background = Color_Active();
						};


					e.LostFocus +=
						delegate
						{
							e.Background = Color_Inactive();
						};
				};

			ApplyActiveColor(KnownDomainsInput);

			var FilterInputHeight = 22;

			var FilterInput = new TextBox
			{
				FontSize = 15,
				Text = KnownFilter,
				BorderThickness = new Thickness(0),
				//Foreground = 0xffffffff.ToSolidColorBrush(),
				Background = Color_Inactive(),
				Width = 400,
				Height = FilterInputHeight,
			}.MoveTo(32, 32 + KnownDomainsInputHeight + 4).AttachTo(this);

			ApplyActiveColor(FilterInput);


			var AnyInputChangedBefore = new List<Action>();

			Action AnyInputChanged =
				delegate
				{
					AnyInputChangedBefore.Do();
					AnyInputChangedBefore.Clear();

					var query = from k in KnownDomainsInput.Text.Split(',')
								let t = k.Trim()
								where t.Contains(FilterInput.Text)
								orderby t
								select t;
//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:AvalonQueryExampleCanvas.cs

示例7: ApplicationCanvas

        public ApplicationCanvas()
        {
            var r0shadow = new Rectangle();
            r0shadow.Opacity = 0.5;
            r0shadow.Fill = Brushes.Black;
            r0shadow.AttachTo(this);

            var r1shadow = new Rectangle();
            r1shadow.Opacity = 0.5;
            r1shadow.Fill = Brushes.Black;
            r1shadow.AttachTo(this);


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


            var r0 = new Rectangle();


            r0.Opacity = 0.8;
            r0.Fill = Brushes.DarkGreen;
            r0.AttachTo(rcontent);

            var r1 = new Rectangle();


            r1.Opacity = 0.8;
            r1.Fill = Brushes.DarkGreen;
            r1.AttachTo(rcontent);
            r1.MoveTo(0, 96);



            r0.SizeTo(500, 96 - 16);
            r1.SizeTo(500, 230);
            r0shadow.SizeTo(500, 96 - 16);
            r1shadow.SizeTo(500, 230);

            var t = new TextBox();

            t.IsReadOnly = true;

            //            type: System.Windows.Controls.TextBlock
            //method: Void set_Foreground(System.Windows.Media.Brush)

            t.Foreground = Brushes.Yellow;
            t.AttachTo(rcontent);
            t.AcceptsReturn = true;
            t.Text = "You have found a shop.\nSee something you like?";
            t.Background = Brushes.Transparent;
            t.BorderThickness = new Thickness(0);
            t.FontSize = 24;
            t.MoveTo(8, 8);


            t2 = new TextBox();

            t2.IsReadOnly = true;

            //            type: System.Windows.Controls.TextBlock
            //method: Void set_Foreground(System.Windows.Media.Brush)

            t2.Foreground = Brushes.Yellow;
            t2.AttachTo(rcontent);
            t2.AcceptsReturn = true;
            t2.Text = "! First we will log you in to FACEBOOK and then to PAYPAL, takes a few...";
            t2.Background = Brushes.Transparent;
            t2.BorderThickness = new Thickness(0);
            t2.MoveTo(8, 290);

            t2o = t2.ToAnimatedOpacity();

            t2o.Opacity = 0.2;

            bg_ammo = new Rectangle();


            bg_ammo.Fill = Brushes.Yellow;
            bg_ammo.AttachTo(rcontent);
            bg_ammo.SizeTo(400, 48);
            bg_ammo.MoveTo(50, 128 + 32 - 8);

            var ammo = new Avalon.Images.avatars_ammo();

            ammo.AttachTo(rcontent);
            ammo.MoveTo(32 + 32, 128 + 32);



            overlay_ammo.Fill = Brushes.Yellow;
            overlay_ammo.Opacity = 0;
            overlay_ammo.AttachTo(rcontent);
            overlay_ammo.SizeTo(400, 48);
            overlay_ammo.MoveTo(50, 128 + 32 - 8);

            var bg_ammo_opacity = bg_ammo.ToAnimatedOpacity();

            overlay_ammo.Cursor = Cursors.Hand;
            bg_ammo_opacity.Opacity = 0.5;
            overlay_ammo.MouseEnter +=
//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:ApplicationCanvas.cs


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