TextBlock text = new TextBlock();
text.Margin = new Thickness(10, 5, 0, 0);
text.Foreground = new SolidColorBrush( Color.FromArgb(255, 255, 0, 0));
text.Name = "messagetext";

 

在后台代码中创建控件之后想要给控件颜色赋值,当时实验了很多次,头都大了,不过最后还是弄出来了,晒出来帮大家一起解决问题。

posted on 2012-09-25 14:35    阅读(2526)  评论(0编辑  收藏  举报