繁体   English   中英

Winforms Designer错误“解析EntityName时发生错误”

[英]Winforms Designer Error “An error occured while parsing EntityName”

我正在为winforms应用程序使用自定义控件代码来创建自定义彩色进度条。 我可以构建它,它工作正常,但每次我尝试使用设计师,它崩溃。 “解析EntityName时发生错误”

编码:

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);
    }
}

}

Dominik aka galaris在他自己的问题中提供了他的答案。 我把它清理干净并移到这里:

解决方案可以在这里找到 问题是我的一个文件夹包含一个&字符 将项目移动到桌面文件夹解决了问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM