你的帖子没咨询看,针对你提的“反射dll”给你一个例子/// <summary>
/// 模糊查询
/// </summary>
/// <param name="ParentForm">父窗体</param>
public static string FuzzyQuery(Form ParentForm)
{
Form _CurrentForm = (Form)Assembly.Load("SMSSystem.Query").CreateInstance("SMSSystem.Query.FRM_FuzzyQuery");
_CurrentForm.ShowDialog(ParentForm);
string _Result = _CurrentForm.GetType().GetProperty("CustomerNO").GetValue(_CurrentForm, null).ToString();
return _Result;
}
/// 模糊查询
/// </summary>
/// <param name="ParentForm">父窗体</param>
public static string FuzzyQuery(Form ParentForm)
{
Form _CurrentForm = (Form)Assembly.Load("SMSSystem.Query").CreateInstance("SMSSystem.Query.FRM_FuzzyQuery");
_CurrentForm.ShowDialog(ParentForm);
string _Result = _CurrentForm.GetType().GetProperty("CustomerNO").GetValue(_CurrentForm, null).ToString();
return _Result;
}
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace DLL封装窗体
{
[ComVisible(true)]
public class WinFormDLL
{
public void showForm()
{
Form1 FRM = new Form1();
FRM.Show();
}
}
}
然后在数据库中记录了dll名称,类名称,方法名称。
希望能通过反射把窗体调用出来。
namespace DLL封装窗体
{
[ComVisible(true)]
public class WinFormDLL
{
public void showForm()
{
Form1 FRM = new Form1();
FRM.Show();
}
}
}
public的
FFunction 是showForm
这个DLL中封装了Form1