我在C#绘图应用程序中有一些错误?

时间:2012-06-12 14:47:18

标签: c# system.drawing

我正在使用visual studio 2010来制作绘图应用程序,但问题是当我尝试编译它所说的程序时

1)“DrawingBoard.DrawingBoard”类型中不存在类型名称“DrawingBoard”第33行

2)“DrawingBoard.DrawingBoard”类型中不存在类型名称“工具箱”第34行

3)非静态字段,方法或属性'DrawingBoard.DrawingBoard.EditOption.get'第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 :(得分:0)

听起来你有一个命名空间问题,看起来DrawingBoard.DrawingBoard可能会引起混淆。尝试重命名您的命名空间以省略重复的名称。使用Solution.Project.Module等格式。在您的情况下,它可能是MySolution.DrawingBoard