
<button WIDth="24" Height="24" > <Image Source="pack://application:,/res/x.png" VerticalAlignment="Center"/></button>
我怎样才能在C#中模仿这个?我在button类中找不到添加子项的任何方法.
解决方法 button是一个Content控件,因此您只需使用buttons Content属性例:
button mybutton = new button{ WIDth = 24,Height = 24,Content = new Image { Source = new BitmAPImage(new Uri("image source")),VerticalAlignment = VerticalAlignment.Center }}; 总结 以上是内存溢出为你收集整理的c# – 以编程方式在Button中添加图像全部内容,希望文章能够帮你解决c# – 以编程方式在Button中添加图像所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)