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

C#编程

开发平台:

Others

  1. using System;
  2. using System.Collections;
  3. using System.ComponentModel;
  4. using System.Drawing;
  5. using System.Data;
  6. using System.Windows.Forms;
  7. namespace ControlDemo
  8. {
  9. /// <summary>
  10. /// Summary description for UserControl1.
  11. /// </summary>
  12. public class UserControl1 : System.Windows.Forms.UserControl
  13. {
  14. private System.Windows.Forms.Button button1;
  15. private System.Windows.Forms.Button button2;
  16. /// <summary>
  17. /// Required designer variable.
  18. /// </summary>
  19. private System.ComponentModel.Container components = null;
  20. public UserControl1()
  21. {
  22. // This call is required by the Windows.Forms Form Designer.
  23. InitializeComponent();
  24. // TODO: Add any initialization after the InitComponent call
  25. }
  26. /// <summary>
  27. /// Clean up any resources being used.
  28. /// </summary>
  29. protected override void Dispose( bool disposing )
  30. {
  31. if( disposing )
  32. {
  33. if( components != null )
  34. components.Dispose();
  35. }
  36. base.Dispose( disposing );
  37. }
  38. #region Component Designer generated code
  39. /// <summary>
  40. /// Required method for Designer support - do not modify 
  41. /// the contents of this method with the code editor.
  42. /// </summary>
  43. private void InitializeComponent()
  44. {
  45. this.button1 = new System.Windows.Forms.Button();
  46. this.button2 = new System.Windows.Forms.Button();
  47. this.SuspendLayout();
  48. // 
  49. // button1
  50. // 
  51. this.button1.Location = new System.Drawing.Point(64, 40);
  52. this.button1.Name = "button1";
  53. this.button1.TabIndex = 0;
  54. this.button1.Text = "button1";
  55. // 
  56. // button2
  57. // 
  58. this.button2.Location = new System.Drawing.Point(32, 104);
  59. this.button2.Name = "button2";
  60. this.button2.TabIndex = 1;
  61. this.button2.Text = "button2";
  62. this.button2.Click += new System.EventHandler(this.button2_Click);
  63. // 
  64. // UserControl1
  65. // 
  66. this.Controls.Add(this.button2);
  67. this.Controls.Add(this.button1);
  68. this.Name = "UserControl1";
  69. this.ResumeLayout(false);
  70. }
  71. #endregion
  72. private void button2_Click(object sender, System.EventArgs e)
  73. {
  74. MessageBox.Show("test");
  75. }
  76. }
  77. }