我需要調用此方法,但我無法在任何名稱空間中找到它。看似簡單的.NET導入
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.creategraphics.aspx
它說,它是在System.Windows.Forms命名空間中,並在System.Windows.Forms.dll中。
我正在使用Visual Studio 2010並將System.Windows.Forms引用導入到項目中。
在頂部我做了一個進口(SRY,我的Java俚語)using FORMS = System.Windows.Forms;
Graphics g = FORMS.CreateGraphics(); // error
錯誤是:「類型或命名空間名稱‘的createGraphics’不存在命名空間存在「System.Windows.Forms的(您是否缺少裝配參考?)「
感謝您的任何幫助。
---編輯---
我試圖運行從頂端回答這個職位代碼:
GDI+/C#: How to save an image as EMF?
---編輯---
隨着用戶的建議,我試圖:
Graphics g = new Graphics();
FORMS.Control a = new FORMS.Control();
g = a.CreateGraphics();
---編輯---
沒關係,對不起人,我很蠢。將在一秒鐘內接受。
那麼你鏈接你的遊戲假設你將你的代碼放在一個表單中。 – 2012-02-22 16:46:51
@Boo,哦,讓我不完全讀它。 – jn1kk 2012-02-22 16:48:36