c# DevExpress 设置SimbleButton背景图片

今天在用Dev的simblebutton 时遇到了一个非常无语的问题,就是设置背景图片无效。直接在属性里设置背景backgroudImage,图片上不显示。由于以前没有用过Dev,用WinForm的按钮试了一下,能设置上,但是simblebutton不行。

参考了这篇文章

https://bbs.csdn.net/topics/390765884

发现设置一个背景图片,需要设置好几个地方,其实设置完backgroudimage后前面几个项自动就加上了,但是按钮上不显示图片,一定要手动设置红色的两行,必须是两行。

LookAndFeel.UseDefaultLookAndFeel 默认是true,图片是不显示的。

按照下面的设置好后,终于背景图加上了。

有一个问题始终没弄明白,就是dev的界面里加了几个winform的按钮,又修改了一下界面的字体后,那几个winform的按钮总是不在我期望的位置上。不太明白。最终还是统一都用dev的控件了。

this.simpleButton1.Appearance.BackColor = System.Drawing.Color.Transparent;
this.simpleButton1.Appearance.Options.UseBackColor = true;
this.simpleButton1.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("simpleButton1.BackgroundImage")));
this.simpleButton1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Zoom;
this.simpleButton1.ButtonStyle = DevExpress.XtraEditors.Controls.BorderStyles.UltraFlat;
this.simpleButton1.Location = new System.Drawing.Point(45, 6);
this.simpleButton1.LookAndFeel.Style = DevExpress.LookAndFeel.LookAndFeelStyle.UltraFlat;
this.simpleButton1.LookAndFeel.UseDefaultLookAndFeel = false;

this.simpleButton1.Name = "simpleButton1";
this.simpleButton1.Size = new System.Drawing.Size(218, 120);
this.simpleButton1.TabIndex = 0;

  • 3
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值