Beispiel #1
0
        protected override void OnDrawText(Graphics g, Rectangle bound, StyleListBoxItemStyle style)
        {
            // Decide which color to use for text
            Color textColor;

            if (Selected)
            {
                textColor = style.SelectedTextColor;
            }
            else
            {
                textColor = style.TextColor;
            }

            // Draw text
            TextRenderer.DrawText(g, this.Text, style.Font, bound.Location, textColor);

            // Draw progressbar
            Rectangle progressbarBound = new Rectangle(bound.X, bound.Y + style.Font.Height + 3, 200, 15);

            ProgressBarRenderer.DrawHorizontalBar(g, progressbarBound);

            progressbarBound.Width  = (int)(progressbarBound.Width * ((float)_used / _size));
            progressbarBound.X      = progressbarBound.X + 1;
            progressbarBound.Y      = progressbarBound.Y + 1;
            progressbarBound.Height = progressbarBound.Height - 2;
            ProgressBarRenderer.DrawHorizontalChunks(g, progressbarBound);

            // Draw the below caption
            TextRenderer.DrawText(g, (_size - _used).ToString() + " GB free of " + _size.ToString() + " GB", style.Font, new Point(bound.X, bound.Y + style.Font.Height + 20), textColor);
        }
Beispiel #2
0
        protected override Size OnMeasureText(Graphics g, StyleListBoxItemStyle style)
        {
            Size size = base.OnMeasureText(g, style);

            size.Height *= 2;
            size.Height += 18;

            return(size);
        }