网创优客建站品牌官网
为成都网站建设公司企业提供高品质网站建设
热线:028-86922220
成都专业网站建设公司

定制建站费用3500元

符合中小企业对网站设计、功能常规化式的企业展示型网站建设

成都品牌网站建设

品牌网站建设费用6000元

本套餐主要针对企业品牌型网站、中高端设计、前端互动体验...

成都商城网站建设

商城网站建设费用8000元

商城网站建设因基本功能的需求不同费用上面也有很大的差别...

成都微信网站建设

手机微信网站建站3000元

手机微信网站开发、微信官网、微信商城网站...

建站知识

当前位置:首页 > 建站知识

WPF如何实现图片按钮-创新互联

这篇文章给大家分享的是有关WPF如何实现图片按钮的内容。小编觉得挺实用的,因此分享给大家做个参考,一起跟随小编过来看看吧。

成都创新互联公司是专业的龙文网站建设公司,龙文接单;提供做网站、网站设计,网页设计,网站设计,建网站,PHP网站建设等专业做网站服务;采用PHP框架,可快速的进行龙文网站开发网页制作和功能扩展;专业做搜索引擎喜爱的网站,专业的做网站团队,希望更多企业前来合作!

,具体内容如下

直接代码

public class ImageButton : System.Windows.Controls.Button
 {

 /// 
 /// 图片
 /// 
 public static readonly DependencyProperty ImageProperty = DependencyProperty.Register("Image", typeof(ImageSource), typeof(ImageButton),
  new PropertyMetadata(null));

 /// 
 /// 图片的宽度
 /// 
 public static readonly DependencyProperty ImageWidthProperty = DependencyProperty.Register("ImageWidth", typeof(double), typeof(ImageButton),
  new PropertyMetadata(double.NaN));

 /// 
 /// 图片的高度
 /// 
 public static readonly DependencyProperty ImageHeightProperty = DependencyProperty.Register("ImageHeight", typeof(double), typeof(ImageButton),
  new PropertyMetadata(double.NaN));

 /// 
 /// 构造函数
 /// 
 static ImageButton()
 {
  DefaultStyleKeyProperty.OverrideMetadata(typeof(ImageButton), 
  new System.Windows.FrameworkPropertyMetadata(typeof(ImageButton)));
 }

 /// 
 /// 设置图片
 /// 
 public ImageSource Image
 {
  get
  {
  return GetValue(ImageProperty) as ImageSource;
  }
  set
  {
  SetValue(ImageProperty, value);
  }
 }

 /// 
 /// 图片宽度(属性)
 /// 
 public double ImageWidth
 {
  get
  {
  return (double)GetValue(ImageWidthProperty);
  }
  set
  {
  SetValue(ImageWidthProperty, value);
  }
 }

 /// 
 /// 图片高度(属性)
 /// 
 public double ImageHeight
 {
  get
  {
  return (double)GetValue(ImageHeightProperty);
  }
  set
  {
  SetValue(ImageHeightProperty, value);
  }
 }

 }

样式代码


 
  
  
   
   
    
    
   
   
   
   
   
   
   
    
   
   

  
  
 
 

调用实例

复制代码 代码如下:

 

效果展示

WPF如何实现图片按钮

感谢各位的阅读!关于“WPF如何实现图片按钮”这篇文章就分享到这里了,希望以上内容可以对大家有一定的帮助,让大家可以学到更多知识,如果觉得文章不错,可以把它分享出去让更多的人看到吧!


文章题目:WPF如何实现图片按钮-创新互联
分享URL:http://bjjierui.cn/article/cdhshe.html

其他资讯