New file |
| | |
| | | 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); |
| | | } |
| | | } |
| | | } |