黄学彪
2020-12-17 9f326f4000847e6167d8166fa2f6a66f53cb3734
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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);
        }
    }
}