我在 C# 绘图应用程序中有一些错误
本文关键字:错误 绘图 应用程序 我在 | 更新日期: 2023-09-27 18:36:59
我正在使用Visual Studio 2010制作绘图应用程序,但问题是当我尝试编译程序时,它说
1)类型名称"绘图板"在类型"绘图板.绘图板"第 33 行中不存在
2)类型名称"工具箱"在类型"绘图板.绘图板"第 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;
}
}
听起来
您遇到了命名空间问题,看起来DrawingBoard.DrawingBoard
可能会导致混乱。尝试重命名命名空间以省略重复的名称。使用格式,例如 Solution.Project.Module
. 在您的情况下,它可能MySolution.DrawingBoard
.