2012-06-12 46 views
-1

我使用Visual Studio 2010中製作繪圖應用程序,但問題是,當我試圖編譯程序,它說我在C#繪圖應用程序中有一些錯誤?

1)類型名稱「畫板」在類型「DrawingBoard.DrawingBoard」 不存在線33

2)類型名稱「工具箱」不存在於類型「DrawingBoard.DrawingBoard」 線34

3)的對象引用是所必需的非靜態字段,方法存在,或屬性'DrawingBoard.DrawingBoard.EditOption.get'line 74

該程序的代碼如下,我已指出錯誤與單詞問題。如果你能幫助我,我會非常感激。

using System.Drawing; 

namespace DrawingBoard 
{ 
    partial class WinForm 
    { 
     /// <summary> 
     /// Required designer variable. 
     /// </summary> 
     private System.ComponentModel.IContainer components = null; 
     /// <summary> 
     /// Clean up any resources being used. 
     /// </summary> 
     /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> 
     protected override void Dispose(bool disposing) 
     { 
      if (disposing && (components != null)) 
      { 
       components.Dispose(); 
      } 
      base.Dispose(disposing); 
     } 

     #region Windows Form Designer generated code 

     /// <summary> 
     /// Required method for Designer support - do not modify 
     /// the contents of this method with the code editor. 
     /// </summary> 
     private void InitializeComponent() 
     { 
      this.splitContainerMain = new System.Windows.Forms.SplitContainer(); 
      this.drawingBoard = new DrawingBoard.DrawingBoard();//problem 
      this.toolBox = new DrawingBoard.Toolbox.ToolBox();//problem 
      this.splitContainerMain.Panel1.SuspendLayout(); 
      this.splitContainerMain.Panel2.SuspendLayout(); 
      this.splitContainerMain.SuspendLayout(); 
      this.SuspendLayout(); 
      // 
      // splitContainerMain 
      // 
      this.splitContainerMain.Dock = System.Windows.Forms.DockStyle.Fill; 
      this.splitContainerMain.Location = new System.Drawing.Point(0, 0); 
      this.splitContainerMain.Margin = new System.Windows.Forms.Padding(2); 
      this.splitContainerMain.Name = "splitContainerMain"; 
      // 
      // splitContainerMain.Panel1 
      // 
      this.splitContainerMain.Panel1.Controls.Add(this.drawingBoard); 
      // 
      // splitContainerMain.Panel2 
      // 
      this.splitContainerMain.Panel2.Controls.Add(this.toolBox); 
      this.splitContainerMain.Size = new System.Drawing.Size(853, 553); 
      this.splitContainerMain.SplitterDistance = 532; 
      this.splitContainerMain.SplitterWidth = 3; 
      this.splitContainerMain.TabIndex = 37; 
      // 
      // drawingBoard 
      // 
      this.drawingBoard.AllowDrop = true; 
      this.drawingBoard.AutoScroll = true; 
      this.drawingBoard.BackColor = System.Drawing.Color.White; 
      this.drawingBoard.BackgroundImageAlpha = ((byte)(255)); 
      this.drawingBoard.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; 
      this.drawingBoard.BackgroundImageX = 0; 
      this.drawingBoard.BackgroundImageY = 0; 
      this.drawingBoard.BoundedCanvasHeight = 1140; 
      this.drawingBoard.BoundedCanvasWidth = 810; 
      this.drawingBoard.CanvasOriginX = 0; 
      this.drawingBoard.CanvasOriginY = 0; 
      this.drawingBoard.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.Default; 
      this.drawingBoard.Dock = System.Windows.Forms.DockStyle.Fill; 
      this.drawingBoard.EditOption = DrawingBoard.EditOption.Select; //problem 
      this.drawingBoard.GridColor = System.Drawing.Color.Gainsboro; 
      this.drawingBoard.GridSize = 0; 
      this.drawingBoard.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.Default; 
      this.drawingBoard.IsBoundedCanvas = true; 
      this.drawingBoard.Location = new System.Drawing.Point(0, 0); 
      this.drawingBoard.Name = "drawingBoard"; 
      this.drawingBoard.PaperOutsideColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(255))))); 
      this.drawingBoard.ShowPaperOutside = true; 
      this.drawingBoard.Size = new System.Drawing.Size(532, 553); 
      this.drawingBoard.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; 
      this.drawingBoard.StickyEditOption = true; 
      this.drawingBoard.TabIndex = 3; 
      this.drawingBoard.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; 
      this.drawingBoard.Zoom = 1F; 
      // 
      // toolBox 
      // 
      this.toolBox.AutoSize = true; 
      this.toolBox.Dock = System.Windows.Forms.DockStyle.Fill; 
      this.toolBox.Drawingboard = null; 
      this.toolBox.Location = new System.Drawing.Point(0, 0); 
      this.toolBox.Margin = new System.Windows.Forms.Padding(4); 
      this.toolBox.Name = "toolBox"; 
      this.toolBox.Size = new System.Drawing.Size(318, 553); 
      this.toolBox.TabIndex = 1; 
      // 
      // WinForm 
      // 
      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); 
      this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 
      this.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(192)))), ((int)(((byte)(255)))), ((int)(((byte)(192))))); 
      this.ClientSize = new System.Drawing.Size(853, 553); 
      this.Controls.Add(this.splitContainerMain); 
      this.Name = "WinForm"; 
      this.Text = "DrawingBoard"; 
      this.splitContainerMain.Panel1.ResumeLayout(false); 
      this.splitContainerMain.Panel2.ResumeLayout(false); 
      this.splitContainerMain.Panel2.PerformLayout(); 
      this.splitContainerMain.ResumeLayout(false); 
      this.ResumeLayout(false); 

     } 

     #endregion 

     private System.Windows.Forms.SplitContainer splitContainerMain; 
     private DrawingBoard drawingBoard; 
     private global::DrawingBoard.Toolbox.ToolBox toolBox; 

    } 
} 
+1

錯誤是什麼行? –

+0

指定行上的錯誤僅表示編譯器無法找到'DrawingBoard'和'ToolBox'類。在不瞭解您的項目和各個班級的聲明的情況下,除此之外,我們無法說出任何事情。 –

+0

1)'DrawingBoard.DrawingBoard'行33中不存在類型名'DrawingBoard'2)類型'DrawingBoard.DrawingBoard'行34中不存在類型名'Toolbox'3)需要對象引用對於非靜態字段,方法或屬性'DrawingBoard.DrawingBoard.EditOption.get'第74行 – alexander

回答

0

這聽起來像你有一個命名空間的問題,它看起來像DrawingBoard.DrawingBoard很可能會造成混亂。嘗試重命名您的名稱空間以省略重複的名稱。使用格式如Solution.Project.Module。在你的情況下,它可能是MySolution.DrawingBoard

相關問題