using System; namespace Shared.Phone.UserCenter { /// /// 一个简单的条形进度条 /// public class ProgressLine : FrameLayout { /// /// 一个简单的条形进度条 /// /// 进度条高度 /// 进度条宽度 public ProgressLine(int height = 3, int width = 1080) { this.Width = Application.GetRealWidth(width); this.Height = height; this.BackgroundColor = UserCenterColor.Current.DeepGray1; } /// /// 设定进度值 /// /// 进度值(与100的比率) /// 从左边开始进度 public void SetValue(decimal value, bool isLeft = true) { this.RemoveAll(); Button button = new Button(); button.Height = this.Height; int width = (int)((value / 100) * this.Width); if (isLeft == false) { button.X = this.Width - width; } button.Width = width; button.BackgroundColor = UserCenterColor.Current.SelectTextColor; this.AddChidren(button); } } }