2015-09-26 55 views
2

我想使用單編譯C#,但單是返回以下錯誤:單找不到字體或顏色

CS0246: the type or namespace name 'Font' could not be found ... 
CS0246: the type or namespace name 'Color' could not be found ... 
CS0246: the type or namespace name 'Color' could not be found ... 

我的import語句是這樣的:

using System; 
using System.Collections.Generic; 
using System.Linq; 
using System.Text; 
using System.Threading.Tasks; 
using System.Drawing; 
using System.Drawing.Font; 
using System.Drawing.Imaging; 
using System.IO; 

任何想法?字體類和顏色結構甚至支持單聲道?我似乎無法找到任何官方支持的文檔,如果您能指出我認爲正確的方向,那又怎麼樣?

+0

您是否包含對System.Drawing的引用?你在使用哪個IDE? – Baltasarq

+0

我正在使用VS 2013,但我使用命令行的單聲道 – TyBourque

回答

1

在一般情況下,使用命令行單的時候,你做這樣的事情:

$ mcs program.cs 

你必須包括,然而,在文件program.cs頂部引用的組件,如系統.Drawing。爲了做到這一點,你必須使用reference開關:

$ mcs /reference:System.Drawing.dll program.cs 

...直到你的程序編譯。

希望這會有所幫助。

+0

好吧,我會給它一個並讓你知道,謝謝 – TyBourque

+1

是的它的工作,真棒 – TyBourque