xm
2020-12-14 d6fb0646531172f23648441c224cdcccd721b894
ZigbeeApp/Shared/Phone/SmartSound/Widget/MyButton.cs
New file
@@ -0,0 +1,49 @@
using System;
namespace Shared.Phone.UserCenter.SmartSound
{
    public class MyButton:Button
    {
        //默认字体大小
        private float textSize = 15;
        public MyButton()
        {
            base.TextSize = textSize;
        }
        public new float TextSize
        {
            get => base.TextSize;
            set
            {
                textSize = value;
                base.TextSize = textSize;
            }
        }
        public new string Text {
            get {
                return base.Text;
            }
            set {
                base.Text = value;
                recalculateWidth();
            }
        }
        public override uint BackgroundColor
        {
            get { return base.BackgroundColor; }
            set
            {
                base.BackgroundColor = value;
                recalculateWidth();
            }
        }
        private void recalculateWidth() {
            this.Width = this.GetTextWidth()+Application.GetRealWidth(50);
        }
    }
}