views:

56

answers:

0

I use ToolStripProgressBar.Paint event handler to do custom drawing on tspb control. As the code below:

private void tsPB_Paint(object sender, PaintEventArgs e)
    {
        var pb = sender as ToolStripProgressBar;
        var g = e.Graphics; var r = e.ClipRectangle; ; var f = SystemFonts.DefaultFont;
        var text = string.Format("{0}%", pb.Value.ToString());
        var sf = StringFormat.GenericDefault; sf.Alignment = StringAlignment.Center;
        g.DrawString(text, f, Brushes.Red, r, sf);
    }

The problem is, the Percentage text was shown on control, but its color was shallow grey, not red. Actually, the color or brush has no effect to the custom text at all; it is always grey - almost invisible. What's wrong or missing in code? Why the text color is always grey??