winform 动态打开网页和form页面

1,利用反射动态显示指定form

Form frm = (Form)AppDomain.CurrentDomain.CreateInstanceFromAndUnwrap(
                    AppDomain.CurrentDomain.BaseDirectory +
                    assembly + ".exe", formName);

frm.show();

如:打开SAMS程序中的frmtest form 页面

Form frm = (Form)AppDomain.CurrentDomain.CreateInstanceFromAndUnwrap(
                    “C:\”+
                    "SAMS"+ ".exe", "SAMS.frmtest");

 1.1:第二种方法

 //Dynamic Call Form using Assembly
  Assembly assembly = Assembly.LoadFrom(@"D:\TEST\SD.dll");
  Form frm = assembly.CreateInstance("SD.frmmain") as Form;
  frm.Show();
  frm.Activate();
  this.Visible = false;

 

2.打开web browser

  System.Diagnostics.Process.Start("IExplore.exe", baseUrl + url + "?role=" + Roles + "&user=" + UserCode);

你可能感兴趣的:(Web,user,assembly,url,browser,WinForm)