添加System.drawing引用 [英] Adding System.drawing reference
本文介绍了添加System.drawing引用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想在c#windows应用程序中绘制图形而不使用'chart'控件。为此,我从添加引用添加了一个引用(system.drawing)。之后我编写了以下代码
Hi,
I want to draw the graphs in c# windows application without using 'chart' control. For that I added a reference (system.drawing) from add reference. After that I wrote the following code
private void button1_Click(object sender, EventArgs e)
{
Pen pen = new Pen(Color.FromArgb(255, 0, 0, 0));
e.Drawing2D.DrawLine(pen, 20, 10, 300, 100);
}
但是我收到的错误是:错误1命名空间'系统中不存在类型或命名空间名称'graphics' .Drawing'(你是否缺少程序集引用?)
But I am getting an error that :Error 1 The type or namespace name 'graphics' does not exist in the namespace 'System.Drawing' (are you missing an assembly reference?)
推荐答案
除了添加引用外,还需要使用System导入名称空间 -.Drawing;
。
了解有关命名空间的更多信息 - 名称空间 [ ^ ]。
Besides adding the reference, you also need to import the namespace -using System.Drawing;
.
Learn more about namespaces - Namespaces[^].
这篇关于添加System.drawing引用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文