WPF后台设置颜色字体等
2021-02-10 18:18
标签:color post AC pos ros fonts 布局 find nts Button TempButton = new Button(); WPF后台设置颜色字体等 标签:color post AC pos ros fonts 布局 find nts 原文地址:https://www.cnblogs.com/kid526940065/p/8516052.html
TempButton.Width = 100;
//颜色
TempButton.Background = new SolidColorBrush(Colors.Black);//背景色
TempButton.Foreground = new SolidColorBrush(Color.FromArgb(0xff, 0x6e, 0x6e, 0x6e));//前景色(字体颜色)
//字体
TempButton.FontWeight = FontWeights.Normal;
//布局
TempButton.Margin = new Thickness(0);
TempButton.HorizontalAlignment = HorizontalAlignment.Right;
//URL
(TempButton.Background as ImageBrush).ImageSource = new BitmapImage(new Uri(“图片路径”), UriKind.Absolute));