C#找不到类型或命名空间名称

来源:百度知道 编辑:UC知道 时间:2024/05/10 16:55:02
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication1
{public class Form1 : System.Windows.Forms.Form
{private System.Windows.Forms.Button button1;
private System.ComponentModel.Container components = null;
public Form1()
{InitializeComponent();}
protected override void Dispose( bool disposing )
{if( disposing )
{if (components != null)
{components.Dispose();}
}base.Dispose( disposing );}
[STAThread]
static void Main()
{Application.Run(new Form1());}
private void button1_Click(object sender, System.EventArgs e)
{Graphics g=this.CreateGraphics();
Pen p1=new Pen(Color.Red,2);
p1.DashStyle=DashStyle.DashDot;
g.DrawRectangle(p1,30,50,300,150);
Pen p2=new Pen(Color.Green,2);
p2.DashStyle=DashStyle.Dot;
g.DrawRectangle(p2,130.0f,150.0f,300.0f,250.

没有格式没有注释代码一片狼籍
况且贴出代码不包括LineCap.怀疑你脑子也一片糨糊
在使用LineCap的地方使用System.Drawing.Drawing2D.LineCap
或引如命名空间
using System.Drawing.Drawing2D;

做程序的人得写好注释呀,这样大家才好看一点。初学者可能还不了解这一点吧

"怀疑你脑子也一片糨糊"

原谅他把,一个不会学习的初学者.
如果半年以后,还是这样,
劝你不要学了.

哎!程序集的引用,在项目里,引用,如果没有自己加个!

LineCap????