在C#代码中设置WPF文本框的背景颜色

在C#代码中设置WPF文本框的背景颜色,第1张

在C#代码中设置WPF文本框的背景颜色
textBox1.Background = Brushes.Blue;textBox1.Foreground = Brushes.Yellow;

WPF前景和背景类型

System.Windows.Media.Brush
。您可以像这样设置其他颜色:

using System.Windows.Media;textBox1.Background = Brushes.White;textBox1.Background = new SolidColorBrush(Colors.White);textBox1.Background = new SolidColorBrush(Color.FromArgb(0xFF, 0xFF, 0, 0));textBox1.Background = System.Windows.SystemColors.MenuHighlightBrush;


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/zaji/5440717.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2022-12-11
下一篇 2022-12-11

发表评论

登录后才能评论

评论列表(0条)

保存