博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
WPF后台设置颜色字体等
阅读量:4658 次
发布时间:2019-06-09

本文共 835 字,大约阅读时间需要 2 分钟。

Button TempButton = new Button();

                      
                        TempButton.Tag = “按钮标记”;
                        TempButton.Height = 30;
                        TempButton.Width = 100;
                        TempButton.Style = this.FindResource("ButtonStyle_blue") as Style;
                                   
                         //颜色
                        TempButton.Background = new SolidColorBrush(Colors.Black);//背景色
                        TempButton.Foreground = new SolidColorBrush(Color.FromArgb(0xff, 0x6e, 0x6e, 0x6e));//前景色(字体颜色)
                        
                        //字体
                        TempButton.FontFamily = new FontFamily("Microsoft YaHei");
                        TempButton.FontSize = 13;
                        TempButton.FontWeight = FontWeights.Normal; 
                         
                         //布局
                        TempButton.Margin = new Thickness(0);      
                        TempButton.VerticalAlignment = VerticalAlignment.Center;
                        TempButton.HorizontalAlignment = HorizontalAlignment.Right;  
                        
                         //URL
                        (TempButton.Background as ImageBrush).ImageSource = new BitmapImage(new Uri(“图片路径”), UriKind.Absolute));
 
                        Wrappanel.Children.Add(TempButton);

转载于:https://www.cnblogs.com/kid526940065/p/8516052.html

你可能感兴趣的文章
[剑指offer] 23. 二叉搜索树的后序遍历序列
查看>>
canvas绘画交叉波浪
查看>>
Linux 内核分析
查看>>
试一下:XP ( SP2 ) 本身就支持查杀流氓软件!
查看>>
centos6(7) minimal 基本环境配置
查看>>
P2837晚餐队列安排
查看>>
DP专题
查看>>
UVa 1402 Runtime Error 伸展树
查看>>
笔记本安装SSD固态硬盘详细的优化设置
查看>>
批处理语法介绍
查看>>
FFmpeg 基础库(三)模块组成
查看>>
Linq 查询 与方法调用
查看>>
iOS开源项目(旧)
查看>>
winform的datagridview控件滚动更新数据
查看>>
java中Object类 源代码详解
查看>>
开源控Meteor的个人资料
查看>>
kafka在zookeeper中的存储结构
查看>>
linux上FTP服务器搭建
查看>>
.net 使用AgsXMPP与openfire连接,实现跨平台信息流通。
查看>>
DP动态规划【专辑@AbandonZHANG】
查看>>