代码在Windows服务项目中不起作用

Rob*_*Rob 1 c# vb.net

嘿伙计们,我目前正在开始我的第一个Windows服务工作,我遇到了我发现的奇怪错误.由于某种原因,编译器告诉我一堆典型的类(如图像,位图,图形等)不存在.例如,这些简单的代码行在正常项目中完美运行,会返回一堆错误:

Bitmap b = new Bitmap(destWidth, destHeight); //Error 13    The type or namespace name 'Bitmap' could not be found (are you missing a using directive or an assembly reference?)
Graphics g = Graphics.FromImage((Image)b); //Error 17   The type or namespace name 'Image' could not be found (are you missing a using directive or an assembly reference?)
g.InterpolationMode = InterpolationMode.HighQualityBicubic; //Error 18  The name 'InterpolationMode' does not exist in the current context
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?(我觉得这是一个简单的答案,但我在服务中绝对需要这些课程)

Dar*_*rov 6

确保已将System.Drawing程序集引用到项目中.的图形类此组件内限定.

  • @Rob,而不是使用部分,你需要[添加参考](http://msdn.microsoft.com/en-us/library/wkze6zky(v = vs.80).aspx)到System.Drawing程序集通过右键单击项目中的References文件夹. (4认同)