公司内部使用的一个系统,是公司以前的一个大牛自己写的,现在他本人已离开公司已经没有源代码了,又无法联系到。由于系统需要修改,将程序反编译并用vs2010打开除掉错误后可以编译成功并能运行,只是卡在不能使用试图设计器,报错的代码如下:
[AccessedThroughProperty("TextBox1")]
private TextBox _TextBox1;
        .
        .
        .
        .
        .
        .
internal virtual TextBox TextBox1
{
[DebuggerNonUserCode]
get
{
return this._TextBox1;
}
[DebuggerNonUserCode]
[MethodImpl(MethodImplOptions.Synchronized)]
set
{
this._TextBox1 = value;
}
}
错误的提示为: 类型“System.Windows.Forms.Form”没有名为“TextBox1”的属性。
把internal virtual TextBox TextBox1{}这一部分删掉,倒是可以进视图设计器,但程序其他地方又要报错。
本人只有vb6的基础,望各位前辈指点一二,不甚感激!

解决方案 »

  1.   

    其中InitializeComponent()函数中的一些命名空间前缀这里是没有添加完整的,还有“成员“location”和“size”的重复声明”贴上来的代码是没有修改的。
    public class AuditingTips : Form
    {
    private static List<WeakReference> __ENCList = new List<WeakReference>();
    private IContainer components;
    [AccessedThroughProperty("pnlContainer")]
    private Panel _pnlContainer;
    [AccessedThroughProperty("btnChange")]
    private Button _btnChange;
    [AccessedThroughProperty("pnlMessage")]
    private Panel _pnlMessage;
    [AccessedThroughProperty("TextBox1")]
    private TextBox _TextBox1;
    [AccessedThroughProperty("rtbMessage")]
    private RichTextBox _rtbMessage;
    [AccessedThroughProperty("PictureBox1")]
    private PictureBox _PictureBox1;
    [AccessedThroughProperty("lblTitle")]
    private Label _lblTitle;
    [AccessedThroughProperty("cmbTrackBill")]
    private ComboBox _cmbTrackBill;
    [AccessedThroughProperty("Process1")]
    private Process _Process1;
    internal virtual Panel pnlContainer
    {
    [DebuggerNonUserCode]
    get
    {
    return this._pnlContainer;
    }
    [DebuggerNonUserCode]
    [MethodImpl(MethodImplOptions.Synchronized)]
    set
    {
    this._pnlContainer = value;
    }
    }
    internal virtual Button btnChange
    {
    [DebuggerNonUserCode]
    get
    {
    return this._btnChange;
    }
    [DebuggerNonUserCode]
    [MethodImpl(MethodImplOptions.Synchronized)]
    set
    {
    this._btnChange = value;
    }
    }
    internal virtual Panel pnlMessage
    {
    [DebuggerNonUserCode]
    get
    {
    return this._pnlMessage;
    }
    [DebuggerNonUserCode]
    [MethodImpl(MethodImplOptions.Synchronized)]
    set
    {
    this._pnlMessage = value;
    }
    }
    internal virtual TextBox TextBox1
    {
    [DebuggerNonUserCode]
    get
    {
    return this._TextBox1;
    }
    [DebuggerNonUserCode]
    [MethodImpl(MethodImplOptions.Synchronized)]
    set
    {
    this._TextBox1 = value;
    }
    }
    protected internal virtual RichTextBox rtbMessage
    {
    [DebuggerNonUserCode]
    get
    {
    return this._rtbMessage;
    }
    [DebuggerNonUserCode]
    [MethodImpl(MethodImplOptions.Synchronized)]
    set
    {
    this._rtbMessage = value;
    }
    }
    internal virtual PictureBox PictureBox1
    {
    [DebuggerNonUserCode]
    get
    {
    return this._PictureBox1;
    }
    [DebuggerNonUserCode]
    [MethodImpl(MethodImplOptions.Synchronized)]
    set
    {
    EventHandler value2 = new EventHandler(this.PictureBox1_Click);
    EventHandler value3 = new EventHandler(this.PictureBox1_MouseLeave);
    EventHandler value4 = new EventHandler(this.PictureBox1_MouseEnter);
    bool flag = this._PictureBox1 != null;
    if (flag)
    {
    this._PictureBox1.Click -= value2;
    this._PictureBox1.MouseLeave -= value3;
    this._PictureBox1.MouseEnter -= value4;
    }
    this._PictureBox1 = value;
    flag = (this._PictureBox1 != null);
    if (flag)
    {
    this._PictureBox1.Click += value2;
    this._PictureBox1.MouseLeave += value3;
    this._PictureBox1.MouseEnter += value4;
    }
    }
    }
    internal virtual Label lblTitle
    {
    [DebuggerNonUserCode]
    get
    {
    return this._lblTitle;
    }
    [DebuggerNonUserCode]
    [MethodImpl(MethodImplOptions.Synchronized)]
    set
    {
    this._lblTitle = value;
    }
    }
    internal virtual ComboBox cmbTrackBill
    {
    [DebuggerNonUserCode]
    get
    {
    return this._cmbTrackBill;
    }
    [DebuggerNonUserCode]
    [MethodImpl(MethodImplOptions.Synchronized)]
    set
    {
    EventHandler value2 = new EventHandler(this.cmbTrackBill_SelectionChangeCommitted);
    bool flag = this._cmbTrackBill != null;
    if (flag)
    {
    this._cmbTrackBill.SelectionChangeCommitted -= value2;
    }
    this._cmbTrackBill = value;
    flag = (this._cmbTrackBill != null);
    if (flag)
    {
    this._cmbTrackBill.SelectionChangeCommitted += value2;
    }
    }
    }
    internal virtual Process Process1
    {
    [DebuggerNonUserCode]
    get
    {
    return this._Process1;
    }
    [DebuggerNonUserCode]
    [MethodImpl(MethodImplOptions.Synchronized)]
    set
    {
    this._Process1 = value;
    }
    }
    public AuditingTips()
    {
    base.Load += new EventHandler(this.AuditingTips_Load);
    List<WeakReference> _ENCList = AuditingTips.__ENCList;
    Monitor.Enter(_ENCList);
    try
    {
    AuditingTips.__ENCList.Add(new WeakReference(this));
    }
    finally
    {
    Monitor.Exit(_ENCList);
    }
    this.bIsClick = false;
    this.InitializeComponent();
    }
    [DebuggerNonUserCode]
    protected override void Dispose(bool disposing)
    {
    try
    {
    bool flag = disposing && this.components != null;
    if (flag)
    {
    this.components.Dispose();
    }
    }
    finally
    {
    base.Dispose(disposing);
    }
    }
      

  2.   

    [DebuggerStepThrough]
    private void InitializeComponent()
    {
    this.pnlContainer = new Panel();
    this.cmbTrackBill = new ComboBox();
    this.btnChange = new Button();
    this.pnlMessage = new Panel();
    this.rtbMessage = new RichTextBox();
    this.TextBox1 = new TextBox();
    this.PictureBox1 = new PictureBox();
    this.lblTitle = new Label();
    this.Process1 = new Process();
    this.pnlContainer.SuspendLayout();
    this.pnlMessage.SuspendLayout();
    ((ISupportInitialize)this.PictureBox1).BeginInit();
    this.SuspendLayout();
    this.pnlContainer.BackColor = Color.Transparent;
    this.pnlContainer.Controls.Add(this.cmbTrackBill);
    this.pnlContainer.Controls.Add(this.btnChange);
    this.pnlContainer.Controls.Add(this.pnlMessage);
    Control arg_100_0 = this.pnlContainer;
    Point location = new Point(2, 23);
    arg_100_0.Location = location;
    this.pnlContainer.Name = "pnlContainer";
    Control arg_12B_0 = this.pnlContainer;
    Padding padding = new Padding(1, 24, 1, 1);
    arg_12B_0.Padding = padding;
    Control arg_14A_0 = this.pnlContainer;
    Size size = new Size(316, 215);
    arg_14A_0.Size = size;
    this.pnlContainer.TabIndex = 0;
    this.pnlContainer.Visible = false;
    this.cmbTrackBill.Font = new Font("宋体", 9f, FontStyle.Regular, GraphicsUnit.Point, 134);
    this.cmbTrackBill.FormattingEnabled = true;
    Control arg_1AA_0 = this.cmbTrackBill;
    location = new Point(1, 2);
    arg_1AA_0.Location = location;
    this.cmbTrackBill.Name = "cmbTrackBill";
    Control arg_1D7_0 = this.cmbTrackBill;
    size = new Size(198, 20);
    arg_1D7_0.Size = size;
    this.cmbTrackBill.TabIndex = 5;
    this.cmbTrackBill.Text = "-单据跟踪-";
    this.btnChange.Font = new Font("宋体", 9f);
    Control arg_22B_0 = this.btnChange;
    location = new Point(234, 1);
    arg_22B_0.Location = location;
    this.btnChange.Name = "btnChange";
    Control arg_255_0 = this.btnChange;
    size = new Size(81, 22);
    arg_255_0.Size = size;
    this.btnChange.TabIndex = 4;
    this.btnChange.Text = "打开消息栏";
    this.btnChange.UseVisualStyleBackColor = true;
    this.pnlMessage.BackColor = Color.Transparent;
    this.pnlMessage.Controls.Add(this.rtbMessage);
    this.pnlMessage.Controls.Add(this.TextBox1);
    this.pnlMessage.Dock = DockStyle.Fill;
    Control arg_2E4_0 = this.pnlMessage;
    location = new Point(1, 24);
    arg_2E4_0.Location = location;
    this.pnlMessage.Name = "pnlMessage";
    Control arg_314_0 = this.pnlMessage;
    size = new Size(314, 190);
    arg_314_0.Size = size;
    this.pnlMessage.TabIndex = 3;
    this.rtbMessage.AcceptsTab = true;
    this.rtbMessage.Anchor = (AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right);
    this.rtbMessage.AutoWordSelection = true;
    this.rtbMessage.BackColor = SystemColors.Window;
    this.rtbMessage.BorderStyle = BorderStyle.None;
    this.rtbMessage.EnableAutoDragDrop = true;
    Control arg_38B_0 = this.rtbMessage;
    location = new Point(2, 2);
    arg_38B_0.Location = location;
    this.rtbMessage.Name = "rtbMessage";
    this.rtbMessage.ReadOnly = true;
    this.rtbMessage.ScrollBars = RichTextBoxScrollBars.ForcedVertical;
    this.rtbMessage.ShowSelectionMargin = true;
    Control arg_3E3_0 = this.rtbMessage;
    size = new Size(311, 187);
    arg_3E3_0.Size = size;
    this.rtbMessage.TabIndex = 1;
    this.rtbMessage.Text = "";
    this.TextBox1.Dock = DockStyle.Fill;
    Control arg_425_0 = this.TextBox1;
    location = new Point(0, 0);
    arg_425_0.Location = location;
    this.TextBox1.Multiline = true;
    this.TextBox1.Name = "TextBox1";
    Control arg_462_0 = this.TextBox1;
    size = new Size(314, 190);
    arg_462_0.Size = size;
    this.TextBox1.TabIndex = 0;
    this.PictureBox1.Anchor = (AnchorStyles.Top | AnchorStyles.Right);
    this.PictureBox1.BackColor = Color.Transparent;
    this.PictureBox1.BackgroundImage = Resources.close;
    Control arg_4BA_0 = this.PictureBox1;
    location = new Point(284, 3);
    arg_4BA_0.Location = location;
    this.PictureBox1.Name = "PictureBox1";
    Control arg_4E4_0 = this.PictureBox1;
    size = new Size(22, 17);
    arg_4E4_0.Size = size;
    this.PictureBox1.TabIndex = 1;
    this.PictureBox1.TabStop = false;
    this.lblTitle.AutoSize = true;
    this.lblTitle.BackColor = Color.Transparent;
    this.lblTitle.Font = new Font("幼圆", 9f, FontStyle.Regular, GraphicsUnit.Point, 134);
    this.lblTitle.ForeColor = Color.White;
    Control arg_567_0 = this.lblTitle;
    location = new Point(10, 4);
    arg_567_0.Location = location;
    this.lblTitle.Name = "lblTitle";
    Control arg_591_0 = this.lblTitle;
    size = new Size(53, 12);
    arg_591_0.Size = size;
    this.lblTitle.TabIndex = 2;
    this.lblTitle.Text = "业务提示";
    this.lblTitle.Visible = false;
    this.Process1.StartInfo.Domain = "";
    this.Process1.StartInfo.LoadUserProfile = false;
    this.Process1.StartInfo.Password = null;
    this.Process1.StartInfo.StandardErrorEncoding = null;
    this.Process1.StartInfo.StandardOutputEncoding = null;
    this.Process1.StartInfo.UserName = "";
    this.Process1.SynchronizingObject = this;
    SizeF autoScaleDimensions = new SizeF(6f, 12f);
    this.AutoScaleDimensions = autoScaleDimensions;
    this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
    this.BackColor = Color.Lime;
    this.BackgroundImage = Resources.tips;
    size = new Size(320, 240);
    this.ClientSize = size;
    this.Controls.Add(this.lblTitle);
    this.Controls.Add(this.PictureBox1);
    this.Controls.Add(this.pnlContainer);
    this.DoubleBuffered = true;
                this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
    this.KeyPreview = true;
    this.MaximizeBox = false;
    size = new Size(320, 240);
    this.MaximumSize = size;
    this.MinimizeBox = false;
    this.Name = "AuditingTips";
    this.Opacity = 0.0;
    padding = new Padding(2, 23, 2, 2);
    this.Padding = padding;
    this.ShowInTaskbar = false;
    this.StartPosition = FormStartPosition.Manual;
    this.Text = "业务通知";
    this.TopMost = true;
    this.TransparencyKey = Color.Lime;
    this.pnlContainer.ResumeLayout(false);
    this.pnlMessage.ResumeLayout(false);
    this.pnlMessage.PerformLayout();
    ((ISupportInitialize)this.PictureBox1).EndInit();
    this.ResumeLayout(false);
    this.PerformLayout();
    }
      

  3.   

    http://blog.csdn.net/ghoulvspol/article/details/6139069
      

  4.   

    把 internal 改为 public 试试。
      

  5.   

    自己搞定了,
    1、直接将internal virtual xxxx 部分给删除,并将其中的注册事件的语句放到InitializeComponent()函数中去;
    2、 删掉[AccessedThroughProperty(xxxxxx)]部分并将private xxxxx部分修改正确;
    3、打开视图设计器会有一些报错按照提示修改正确即可;