我正在嘗試編寫不使用MS Designer的表單代碼。C#(Visual Studio 2010)未找到包含的參考
當我編譯,我一直得到同樣的錯誤:
類型System.ComponentModel *在未引用的程序集定義。
這將顯示IComponent,ISynchronizeInvoke和Component。我想我已經參考了它。
我嘗試刪除引用並重新應用它,並切換到早期版本的.net。它必須是我的環境中的東西,但我找不到它。
using System;
using System.ComponentModel;
using System.Windows.Forms;
public class EmptyForm : System.Windows.Forms.Form
{
public EmptyForm()
{
}
public static int Main()
{
Application.Run(new EmptyForm());
return 0;
}
}
'System.ComponentModel.Component'是**類型**,不是程序集。 'System.ComponentModel.Composition'與此無關。 – SLaks
爲什麼要手動編寫Windows窗體(沒有設計者)? –
@RyanGates有很多案例可以做到這一點,我經常使用的其中一個是動態表單創建。 – Magnum