views:

28

answers:

0

Iam using a custom control code for my winforms application to create a custom colored progressbar. I can build it, and it works fine, BUT everytime I try to use designer, it crashes. "An error occured while parsing EntityName"

If I add from the toolbox, this is what I get: http://img188.imageshack.us/f/43680242.jpg/

If I insert a progressbar, then rewerite the code for my control (replace progressBar with progressBarEx), then this is what I get : http://img843.imageshack.us/f/47990282.jpg/

using System.Drawing;
using System.Windows.Forms;

namespace Crystal
{
public class ProgressBarEx : ProgressBar
{
    private SolidBrush brush = null;

    public ProgressBarEx()
    {
        this.SetStyle(ControlStyles.UserPaint, true);
    }

    protected override void OnPaint(PaintEventArgs e)
    {
        if (brush == null || brush.Color != this.ForeColor)
            brush = new SolidBrush(this.ForeColor);

        Rectangle rec = new Rectangle(0, 0, this.Width, this.Height);
        if (ProgressBarRenderer.IsSupported)
            ProgressBarRenderer.DrawHorizontalBar(e.Graphics, rec);
        rec.Width = (int)(rec.Width * ((double)Value / Maximum)) - 4;
        rec.Height = rec.Height - 4;
        e.Graphics.FillRectangle(brush, 2, 2, rec.Width, rec.Height);
    }
}

}

EDIT! I found solution here: http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/5884c3db-63d3-44ca-a6b3-3dde6d361f1d

I solved this with copying my project to desktop. One of my folders contained '&' character, which caused the trouble.