且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何将Windows窗体转换为DLL

更新时间:2023-12-06 09:31:16

创建一个新的类库项目(每个窗体一个,或者一个覆盖它们)。

在解决方案资源管理器窗格中,右键单击您的DLL项目名称,然后选择添加 ...现有项目。

在结果对话框中,选择构成表单的文件 - 您只需要myForm.cs或MyForm.vb文件,而不是.designer.cs或.resx文件 - 它们将被自动拾取。

当你按OK时,文件将被复制到你的新项目。

完成!编译,你就离开了。
Create a new Class Library project (either one per form, or one to cover them all).
In the Solution Explorer pane, right click your DLL project name, and select "Add...Existing Item".
In the dialog that results, select the file or files that make up your form(s) - you only need the myForm.cs or MyForm.vb files, not the .designer.cs or .resx files - they will be picked up automatically.
When you press OK, the files will be copied to your new project.
Done! Compile, and you are off.