Form1.cs
上传用户:lxycoco
上传日期:2022-07-21
资源大小:38457k
文件大小:3k
源码类别:

C#编程

开发平台:

Others

  1. using System;
  2. using System.Drawing;
  3. using System.Collections;
  4. using System.ComponentModel;
  5. using System.Windows.Forms;
  6. using System.Data;
  7. using System.Reflection;
  8. namespace SampleClientLoadFrom
  9. {
  10. /// <summary>
  11. /// Summary description for Form1.
  12. /// </summary>
  13. public class Form1 : System.Windows.Forms.Form
  14. {
  15.     private System.Windows.Forms.Button button1;
  16.     private System.Windows.Forms.Label label1;
  17. /// <summary>
  18. /// Required designer variable.
  19. /// </summary>
  20. private System.ComponentModel.Container components = null;
  21. public Form1()
  22. {
  23. //
  24. // Required for Windows Form Designer support
  25. //
  26. InitializeComponent();
  27. //
  28. // TODO: Add any constructor code after InitializeComponent call
  29. //
  30. }
  31. /// <summary>
  32. /// Clean up any resources being used.
  33. /// </summary>
  34. protected override void Dispose( bool disposing )
  35. {
  36. if( disposing )
  37. {
  38. if (components != null) 
  39. {
  40. components.Dispose();
  41. }
  42. }
  43. base.Dispose( disposing );
  44. }
  45. #region Windows Form Designer generated code
  46. /// <summary>
  47. /// Required method for Designer support - do not modify
  48. /// the contents of this method with the code editor.
  49. /// </summary>
  50. private void InitializeComponent()
  51. {
  52.       this.button1 = new System.Windows.Forms.Button();
  53.       this.label1 = new System.Windows.Forms.Label();
  54.       this.SuspendLayout();
  55.       // 
  56.       // button1
  57.       // 
  58.       this.button1.Location = new System.Drawing.Point(104, 112);
  59.       this.button1.Name = "button1";
  60.       this.button1.TabIndex = 0;
  61.       this.button1.Text = "button1";
  62.       this.button1.Click += new System.EventHandler(this.button1_Click);
  63.       // 
  64.       // label1
  65.       // 
  66.       this.label1.Location = new System.Drawing.Point(64, 48);
  67.       this.label1.Name = "label1";
  68.       this.label1.Size = new System.Drawing.Size(168, 23);
  69.       this.label1.TabIndex = 1;
  70.       this.label1.Text = "label1";
  71.       // 
  72.       // Form1
  73.       // 
  74.       this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
  75.       this.ClientSize = new System.Drawing.Size(292, 273);
  76.       this.Controls.Add(this.label1);
  77.       this.Controls.Add(this.button1);
  78.       this.Name = "Form1";
  79.       this.Text = "Form1";
  80.       this.ResumeLayout(false);
  81.     }
  82. #endregion
  83. /// <summary>
  84. /// The main entry point for the application.
  85. /// </summary>
  86. [STAThread]
  87. static void Main() 
  88. {
  89. Application.Run(new Form1());
  90. }
  91.     private void button1_Click(object sender, System.EventArgs e)
  92.     {
  93.       Assembly testAssembly = Assembly.LoadFrom("http://localhost/AppSupport/AppSupportII.dll");
  94.       Type type = testAssembly.GetType("AppSupportII.TestClass");
  95.       object testObject = Activator.CreateInstance(type);
  96.       label1.Text = (string)type.GetMethod("TestMethod").Invoke(testObject,null);
  97.     }
  98. }
  99. }