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";
在后台代码中创建控件之后想要给控件颜色赋值,当时实验了很多次,头都大了,不过最后还是弄出来了,晒出来帮大家一起解决问题。
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";
在后台代码中创建控件之后想要给控件颜色赋值,当时实验了很多次,头都大了,不过最后还是弄出来了,晒出来帮大家一起解决问题。
转载于:https://www.cnblogs.com/zhengfn/archive/2012/09/25/2701511.html