Winforms Designer Error "An error occured while parsing EntityName"
I'am 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.
If I insert a progressbar, then rewerite the code for my control (replace
progressBar
withprogressBarEx
), then this is what I get.
The code:
using System.Drawing;
using System.Windows.Forms;
namespace Crystal
{
public class ProgressBarEx : ProgressBar
{
开发者_JAVA技巧 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);
}
}
}
Dominik aka galaris provided his answer in his own question. I cleaned it up and moved it here:
The solution can be found here. The problem is that one of my folders contained a &
character. Moving the project to the desktop folder solved the problem.
精彩评论