后台添加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         }

 

转载于:https://www.cnblogs.com/ants_double/p/5366432.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值