コード例 #1
0
        public override void Draw()
        {
            var rb         = RenderBounds;
            var percentage = GetPercentage();

            WidgetUtils.DrawPanel(Background, rb);

            var minBarWidth = ChromeProvider.GetMinimumPanelSize(Bar).Width;
            var maxBarWidth = rb.Width - BarMargin.Width * 2;
            var barWidth    = wasIndeterminate ? maxBarWidth / 4 : percentage * maxBarWidth / 100;

            barWidth = Math.Max(barWidth, minBarWidth);

            var barOffset = wasIndeterminate ? (int)(0.75 * offset * maxBarWidth) : 0;
            var barRect   = new Rectangle(rb.X + BarMargin.Width + barOffset, rb.Y + BarMargin.Height, barWidth, rb.Height - 2 * BarMargin.Height);

            WidgetUtils.DrawPanel(Bar, barRect);
        }