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


C# TextBox.AppendText方法代码示例

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


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

示例1: CalculateLoadScheme

        public List<Container> CalculateLoadScheme(List<Container> containers,
            ObservableCollection<Vehicle> selectedVehicles, TextBox textBox, int maxTonnage)
        {
            // BtnCalculate_click
            int tempMaxTonnage;
            var widthBetweenVehicles = 1000;
            var tempPoint = new Point3D(0, 0, 0);
            textBox.Clear();
            textBox.AppendText("Протокол расчета схемы загрузки:\n");
            var tempList = RotateContainers(containers);

            foreach (var vehicle in selectedVehicles)
            {
                LocateContainers locateContainers = new LocateContainers(vehicle);

                tempMaxTonnage = maxTonnage == 0 ? vehicle.Tonnage : maxTonnage;
                tempList = locateContainers.DownloadContainers(tempList, tempMaxTonnage);
                SetFirstPoint(tempPoint,vehicle);
                tempPoint.Y = tempPoint.Y + widthBetweenVehicles + vehicle.Width;// TODO tempPoint.Z = tempPoint.Z + widthBetweenVehicles + vehicle.Width;
                PutCargoInfoInTextBox(vehicle, textBox);
                CheckOverweight(vehicle, textBox, tempMaxTonnage);
                VehicleAxisMass vehicleAxisMass = new VehicleAxisMass(vehicle, vehicle.Mass);
                PutVehAxisMassInfoInTextBox(vehicleAxisMass.AxisMassCalculate(), textBox);
            }
            PutWasteContainersInfoInTextBox(tempList, textBox);
            CheckErrors(tempList, textBox, selectedVehicles, containers);

            return tempList;
        }
开发者ID:RadSt,项目名称:WPF-App-For-Ref,代码行数:29,代码来源:Calculation.cs

示例2: arvonta

    // Methods *****************
    public string arvonta(TextBox outcome)
    {
      metodi m;
      
      switch (mode)
      {
        case 0:
          m = Logics.suomi;
          break;
        case 1:
          m = Logics.viking;
          break;
        case 2:
          m = Logics.euro;
          break;
        default:
          // If mode is not defined throw exception
          throw new Exception("Error #666. Lottery mode was not defined!");
      }
      
      for(int i = 0; i < drawns; i++)
      {
        outcome.AppendText(m() + "\n");
      }

      return "Arvonta tehty :D";
    }
开发者ID:msilo,项目名称:IIO11300,代码行数:28,代码来源:Lotto.cs

示例3: PutVehAxisMassInfoInTextBox

        private void PutVehAxisMassInfoInTextBox(List<double> axisMassList,TextBox textBox)
        {
            for (int i=0; i<axisMassList.Count;i++)
            {
                textBox.AppendText(String.Format("Нагрузка на ось{0} - {1:0.000} \n", (i + 1), axisMassList[i]));
            }

        }
开发者ID:RadSt,项目名称:WPF-App-For-Ref,代码行数:8,代码来源:Calculation.cs

示例4: TextBoxUndoTest

 public void TextBoxUndoTest()
 {
     var textBox = new TextBox();
     Assert.IsTrue(textBox.IsUndoEnabled);
     Assert.AreEqual(100,textBox.UndoLimit);
     textBox.AppendText("1");
     Assert.IsTrue(textBox.CanUndo);
     // Assert.AreEqual(null, textBox.Text);
 }
开发者ID:JohanLarsson,项目名称:UndoRedo,代码行数:9,代码来源:UpdateSourceAndTarget.cs

示例5: TextBoxTraceListener

        public TextBoxTraceListener(TextBox target)
        {
            Target = target;

            _sendStringAction = delegate(string message)
            {
                // No need to lock text box as this function will only
                // ever be executed from the UI thread

                Target.AppendText(message);
            };
        }
开发者ID:kingofcrabs,项目名称:BoundaryID,代码行数:12,代码来源:TextBoxTraceListener.cs

示例6: MyCanvas

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

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

			var t = new TextBox
			{
				AcceptsReturn = true,
				Text = "powered by jsc",
				BorderThickness = new Thickness(0),
				Foreground = Brushes.Black,
				Background = Brushes.White,
				IsReadOnly = true,
				Width = 300,
				Height = 300
			}.MoveTo(32, 32).AttachTo(this);

			var m = new MemoryStream();
			var w = new BinaryWriter(m);

			w.Write((byte)6);
			w.Write((short)7);
			w.Write((int)8);
			w.Write("hey Ԉ \ufffc \u00ff \u0100");

			t.AppendTextLine();

			foreach (var v in m.ToArray())
			{
				t.AppendText(v + " ");
			}

			m.Position = 0;

			var r = new BinaryReader(m);

			t.AppendTextLine();
			t.AppendTextLine("bytes: " + r.BaseStream.Length);
			t.AppendTextLine("byte " + r.ReadByte());
			t.AppendTextLine("short " + r.ReadInt16());
			t.AppendTextLine("int " + r.ReadInt32());
			t.AppendTextLine("string " + r.ReadString());
		}
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:53,代码来源:MyCanvas.cs

示例7: LoggedTextBox

        public LoggedTextBox(TextBox textBox)
        {
            string outputDir = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\BenchmarkApplication\";
            var df = new DirectoryInfo(outputDir);
            if (! df.Exists)
            {
                df = Directory.CreateDirectory(df.FullName);
            }

            string fileName = string.Format(df.FullName + "BenchmarkApplication{0}.log", DateTime.Now.ToFileTime());
            var logFile = new FileStream(fileName, FileMode.Append, FileAccess.Write, FileShare.None);
            this.streamWriter = new StreamWriter(logFile);
            this.textBox = textBox;

            this.appendText = delegate(string text)
            {
                textBox.AppendText(text);
                textBox.ScrollToEnd();
                textBox.Focus();
            };
        }
开发者ID:PeterLuschny,项目名称:Fast-Factorial-Functions,代码行数:21,代码来源:LoggedTextBox.cs

示例8: MyCanvas

        public MyCanvas()
        {
            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(),
                    Fill = ((uint)(0xff00007F + (int)(128 * i / DefaultHeight))).ToSolidColorBrush(),
                    Width = DefaultWidth,
                    Height = 4,
                }.MoveTo(0, i).AttachTo(this);
            }
            #endregion

            var help_idle = new Image
            {
                Source = "assets/ZipExample2/help_idle.png".ToSource()
            }.AttachTo(this);

            var help = new Image
            {
                Source = "assets/ZipExample2/help.png".ToSource()
            }.AttachTo(this);

            help.Opacity = 0;

            var img = new Image
            {
                Source = "assets/ZipExample2/jsc.png".ToSource()
            }.MoveTo(DefaultWidth - 128, DefaultHeight - 128).AttachTo(this);

            var t = new TextBox
            {
                FontSize = 32,
                Text = "archive: ",
                BorderThickness = new Thickness(0),
                Foreground = 0xffffffff.ToSolidColorBrush(),
                Background = Brushes.Transparent,
                IsReadOnly = true
            }.MoveTo(32, 32).AttachTo(this);


            var zip = "assets/ZipExample2/dude5.zip".ToZIPFile();

            t.AppendText(zip.Items.Count + " " + zip.Items.First().FileName);

            var AnimatedImage = new Image
            {
                RenderTransform = new ScaleTransform { ScaleX = 2, ScaleY = 2 }
            }.MoveTo(64, 64).AttachTo(this);

            var AnimationIndex = 0;
            var AnimationCounter = 0;

            (1000 / 8).AtInterval(
                () =>
                {
                    AnimationCounter++;

                    AnimationIndex += 8;

                    if ((AnimationCounter % (zip.Items.Count / 8)) == 0)
                        AnimationIndex++;

                    var n = zip.Items.AtModulus(AnimationIndex);



                    t.Text = "# " + n.FileName;



                    AnimatedImage.Source = n.Data.ToSource();
                }
            );

            help_idle.Opacity = 0;
            help.Opacity = 1;
            img.Opacity = 0.5;

            t.MouseEnter +=
                delegate
                {
                    help_idle.Opacity = 1;
                    help.Opacity = 0;

                    img.Opacity = 1;
                    t.Foreground = 0xffffff00.ToSolidColorBrush();
                };

            t.MouseLeave +=
                delegate
                {
                    help_idle.Opacity = 0;
                    help.Opacity = 1;

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

示例9: AppendToInfoBox

 private void AppendToInfoBox(TextBox e, String appendedText)
 {
     if (this.Dispatcher.Thread == Thread.CurrentThread)
     {
         e.AppendText(appendedText);
         e.ScrollToEnd();
     }
     else
     {
         this.Dispatcher.Invoke(new SingleStringDelegate(AppendToInfoBox), e, appendedText);
     }        
 }
开发者ID:wshanshan,项目名称:DDD,代码行数:12,代码来源:MainWindow.xaml.cs

示例10: AppendText

 void AppendText(TextBox box, string text)
 {
     box.AppendText(text);
 }
开发者ID:kidleon,项目名称:Squirt,代码行数:4,代码来源:TextBoxWriter.cs

示例11: AppendLineToTextBox

 public static void AppendLineToTextBox(TextBox textBox, string message)
 {
     textBox.AppendText(message + Environment.NewLine);
     if (textBox.Text.Length > 12000)
     {
         string text = textBox.Text;
         text = text.Substring(text.Length - 10000, 10000);
         int index = text.IndexOf(Environment.NewLine);
         if (index != -1)
         {
             text = text.Substring(index + Environment.NewLine.Length);
         }
         textBox.Text = text;
     }
     textBox.CaretIndex = textBox.Text.Length;
     textBox.ScrollToEnd();
 }
开发者ID:Rympex,项目名称:proshine,代码行数:17,代码来源:MainWindow.xaml.cs

示例12: ApplicationCanvas

        public ApplicationCanvas()
        {
            r.Fill = Brushes.LightGray;
            r.AttachTo(this);
            r.MoveTo(4, 4);
            this.SizeChanged += (s, e) => r.SizeTo(this.Width - 8.0, this.Height - 8.0);

            var label1 = new TextBlock
            {
                Text = "Enter a list of names separated by commas",
            }.AttachTo(this).MoveTo(8, 8);

            var users = new TextBox
            {
                AcceptsReturn = true,
                TextWrapping = System.Windows.TextWrapping.Wrap,
                Width = 500,
                Height = 50,
                Text = "_martin, mike, mac, ken, neo, zen, jay, morpheous, trinity, Agent Smith, _psycho",
            }.AttachTo(this).MoveTo(8, 8 + 32);



            var label2 = new TextBlock
            {
                Text = "Enter a partial name to be found from the list above.",
            }.AttachTo(this).MoveTo(8, 8 + 32 + 50 + 8);

            var filter = new TextBox
            {
                Width = 500,
                Text = "psy",
            }.AttachTo(this).MoveTo(8, 8 + 32 + 50 + 8 + 16);

            var label3 = new TextBlock
            {
                Text = "Enter a partial name to make the entry special",
            }.AttachTo(this).MoveTo(8, 8 + 32 + 50 + 8 + 58);

            var filter2 = new TextBox
            {
                Width = 500,
                Text = "a",
            }.AttachTo(this).MoveTo(8, 8 + 32 + 50 + 8 + 16 + 58);



            var label4 = new TextBlock
            {
                Text = "Results",
            }.AttachTo(this).MoveTo(8, 8 + 32 + 50 + 8 + 58 + 58);

            var result = new TextBox
            {
                AcceptsReturn = true,
                TextWrapping = System.Windows.TextWrapping.Wrap,

                Background = Brushes.Transparent,
                BorderThickness = new Thickness(0),

                Width = 500,
                Height = 50,
                Text = "?",
                TextAlignment = System.Windows.TextAlignment.Right,
                IsReadOnly = true,
            }.AttachTo(this).MoveTo(8, 8 + 32 + 50 + 8 + 16 + 58 + 58);

            Action Update =
                delegate
                {
                    var user_filter = filter.Text.Trim().ToLower();
                    var user_filter2 = filter2.Text.Trim().ToLower();

                    result.Clear();

                    var __users = users.Text.Split(',');


                    var query = from i in __users
                                where i.ToLower().Contains(user_filter)
                                let name = i.Trim()
                                let isspecial = i.ToLower().Contains(user_filter2)
                                orderby isspecial ascending, name.Length descending, name
                                select new { isspecial, length = name.Length, name };

                    foreach (var v in query)
                    {
                        var m = "match: " + v;

                        if (v.isspecial)
                            m = m.ToUpper();

                        result.AppendText(m + Environment.NewLine);
                    }
                };

            Update();

            users.TextChanged += delegate { Update(); };
            filter.TextChanged += delegate { Update(); };
//.........这里部分代码省略.........
开发者ID:exaphaser,项目名称:JSC-Cross-Compiler,代码行数:101,代码来源:ApplicationCanvas.cs

示例13: AddLogText

        /// <summary>
        /// Update wallet log.
        /// </summary>
        /// <param name="text"></param>
        /// <param name="logLines"></param>
        /// <param name="textBox"></param>
        /// <param name="scrollViewer"></param>
        private void AddLogText(string text, IList<string> logLines, TextBox textBox, ScrollViewer scrollViewer)
        {
            while (logLines.Count >= 50)
            {
                logLines.RemoveAt(0);
            }

            logLines.Add(text);

            if (logLines.Count == 1)
            {
                textBox.Text = logLines.First();
            }
            else
            {
                textBox.Text = logLines.Aggregate((l1, l2) => l1 + Environment.NewLine + l2);
                textBox.AppendText(Environment.NewLine); // Hack: make sure scroll to bottom works
                scrollViewer.ScrollToBottom();
            }
        }
开发者ID:rrydman,项目名称:CryptoNoteWallet,代码行数:27,代码来源:MainWindow.xaml.cs

示例14: PutCargoInfoInTextBox

 private void PutCargoInfoInTextBox(Vehicle v, TextBox textBox)
 {
     textBox.AppendText("Загрузка автомобиля " + v.Name + " :\n");
     textBox.AppendText("  количество контейнеров - " + v.Count + " :\n");
     textBox.AppendText("  вес груза - " + v.Mass + " :\n");
 }
开发者ID:RadSt,项目名称:WPF-App-For-Ref,代码行数:6,代码来源:Calculation.cs

示例15: CheckOverweight

 private void CheckOverweight(Vehicle vehicle, TextBox textBox, int MaxTonnage)
 {
     var p = vehicle.GetMassCenter();
     var maxTonnage = MaxTonnage*(vehicle.EmptyTonnage*vehicle.Length + 2*p.X*vehicle.Mass)/(vehicle.Length*(vehicle.EmptyTonnage + vehicle.Mass));
     if (vehicle.Mass > maxTonnage & p.X < vehicle.Length/2)
     {
         textBox.AppendText("Превышение нагрузки на переднюю ось \n");
     }
     if (vehicle.Mass > maxTonnage & p.X > vehicle.Length/2)
     {
         textBox.AppendText("Превышение нагрузки на заднюю ось \n");
     }
     if (vehicle.Mass > maxTonnage & p.X == vehicle.Length/2)
     {
         textBox.AppendText("Превышение нагрузки на все оси \n");
     }
 }
开发者ID:RadSt,项目名称:WPF-App-For-Ref,代码行数:17,代码来源:Calculation.cs


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