![](/img/trans.png)
[英]Which class can I use to pass a "RecordSet" between an WinForm VB.Net EXE program and a classes DLL?
[英]Which project templates I can use to create a winform dll library?
Visual Studio中的哪些項目模板適合於創建Winform dll libaray。 我想用它來創建一個插件界面窗口。 我正在尋找Wiforms中WPF User Control Library
的替代方法。
創建Windows窗體控件庫更合適。
一個用於創建要在Windows窗體應用程序中使用的控件的項目
這樣,它將與Windows窗體相關的程序集添加到項目中,而您無需自己添加它們。 除了類庫項目,它還具有以下參考:
System.Drawing
System.Windows.Forms
如果打開“添加新項目”對話框,則可以在以下路徑中找到它:
Visual C# > Windows Desktop > Windows Forms Control Library
Visual Basic > Windows Desktop > Windows Forms Control Library
使用項目模板Class Library
創建項目
如果要在庫中使用WinForm
類,則必須添加對System.Windows.Forms
的引用,因為默認情況下,它不包含在Class Library
項目中(它們通常用於不支持實用程序功能的工具)需要GUI元素)並不是說在庫中包含GUI元素是錯誤的,只是很少見,因此默認情況下它們不會費心包含它來減少依賴關系。
添加System.Windows.Forms
:
解決方案資源管理器->右鍵單擊引用->添加引用->程序集->框架
然后滾動,直到找到System.Windows.Forms
,將其選中並單擊“確定”。 現在,您可以在庫中使用WinForm
對象。
如果您發現自己需要測試庫GUI元素,則Windows Forms Control Library
模板項目可能是一個更好的選擇
Winforms有一個類似的模板,稱為“ Windows窗體控件庫”。 這就是您要尋找的。
順便說一句,您可以只使用“類庫”模板並手動添加Windows.Forms庫引用。
唯一的區別是您不能運行類庫項目,而可以運行“ Windows Forms控件庫”項目,在該項目中顯示UI來測試用戶控件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.