后台添加Textbox
1 /// <summary> 2 /// behind add textbox 3 /// </summary> 4 private void AddTextToTextBox() 5 { 6 TextBlock tb = new TextBlock(); 7 tb.TextWrapping = TextWrapping.Wrap; 8 tb.Margin = new Thickness(10); 9 tb.Inlines.Add("An example on "); 10 tb.Inlines.Add(new Run("the TextBlock control ") { FontWeight = FontWeights.Bold }); 11 tb.Inlines.Add("using "); 12 tb.Inlines.Add(new Run("inline ") { FontStyle = FontStyles.Italic }); 13 tb.Inlines.Add(new Run("text formatting ") { Foreground = Brushes.Blue }); 14 tb.Inlines.Add("from "); 15 tb.Inlines.Add(new Run("Code-Behind") { TextDecorations = TextDecorations.Underline }); 16 tb.Inlines.Add("."); 17 this.sp_text.Children.Add(tb); 18 }
作者:Ants_double
出处:https://www.cnblogs.com/ants_double/
本文版权归作者和博客园所有,欢迎转载。转载请在留言板处留言给我,且在文章标明原文链接,谢谢!
如果您觉得本篇博文对您有所收获,觉得我还算用心,请点击右下角的 [大拇指],谢谢!