Click here to Skip to main content
15,886,137 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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
C#
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);
    }

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?)
Posted
Updated 9-Apr-15 23:21pm
v2
Comments
Kriti Sharma 10400841 10-Apr-15 5:11am    
add namespace system.drawing.2d;
Member 10994712 10-Apr-15 5:34am    
I added system.drawing.2d but still I got the error

1 solution

Besides adding the reference, you also need to import the namespace - using System.Drawing;.

Learn more about namespaces - Namespaces[^].
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900