Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

Image Dummy = Image.FromFile("image.png");
Dummy.Save("image.bmp", ImageFormat.Bmp);

what the question says

i have these

using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Drawing.Drawing2D;

but i get an error saying that the namespace drawing does not exist in the namespace system :/

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
153 views
Welcome To Ask or Share your Answers For Others

1 Answer

Add a reference to System.Drawing

When you use using statements, this lets the compiler know that when you say Image you really mean System.Drawing.Image for example.

However, now the compiler needs to know where System.Drawing is. By default, in Visual Studio, you will probably already reference System, System.Data, and System.Xml.

Now you are writing for System.Drawing. Right-click the project in the project browser, and select "Add reference...". This will present you with a tabbed interface that lets you select one of:

  • A .NET Reference. Any assembly in the GAC will be listed here. Scroll down and select System.Drawing for example.
  • COM Reference. For interfacing with non-.NET, yet very Windows components.
  • Projects. A Visual Studio nicety. Reference a DLL that has not been built yet. Select a project within the same solution. Intellisense before you compile.
  • Browse (for a file). If a .NET component or other type with exported definitions has already been built, you can reference the DLL from here.

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...