home *** CD-ROM | disk | FTP | other *** search
- using System;
- using System.Collections;
- using System.ComponentModel;
- using System.Drawing;
- using System.Data;
- using System.Windows.Forms;
-
- namespace myControl
- {
- /// <summary>
- /// Summary description for UserControl1.
- /// </summary>
- public class myCtrl : System.Windows.Forms.UserControl
- {
- private string _msg = "Hello world!";
-
- private System.Windows.Forms.TextBox textBox1;
- private System.Windows.Forms.Button button1;
- /// <summary>
- /// Required designer variable.
- /// </summary>
- private System.ComponentModel.Container components = null;
-
- public myCtrl()
- {
- // This call is required by the Windows.Forms Form Designer.
- InitializeComponent();
-
- // TODO: Add any initialization after the InitForm call
-
- }
-
- /// <summary>
- /// Clean up any resources being used.
- /// </summary>
- protected override void Dispose( bool disposing )
- {
- if( disposing )
- {
- if( components != null )
- components.Dispose();
- }
- base.Dispose( disposing );
- }
-
- #region Component Designer generated code
- /// <summary>
- /// Required method for Designer support - do not modify
- /// the contents of this method with the code editor.
- /// </summary>
- private void InitializeComponent()
- {
- this.textBox1 = new System.Windows.Forms.TextBox();
- this.button1 = new System.Windows.Forms.Button();
- this.SuspendLayout();
- //
- // textBox1
- //
- this.textBox1.Location = new System.Drawing.Point(24, 24);
- this.textBox1.Name = "textBox1";
- this.textBox1.TabIndex = 0;
- this.textBox1.Text = "";
- //
- // button1
- //
- this.button1.Location = new System.Drawing.Point(24, 80);
- this.button1.Name = "button1";
- this.button1.TabIndex = 1;
- this.button1.Text = "Click Me!";
- this.button1.Click += new System.EventHandler(this.button1_Click);
- //
- // myControl
- //
- this.Controls.AddRange(new System.Windows.Forms.Control[] {
- this.button1,
- this.textBox1});
- this.Name = "myControl";
- this.ResumeLayout(false);
-
- }
- #endregion
-
- // User-defined Properties
- [Browsable(true),
- Category("Absolutely Fabulous"),
- Description("Specifies the message to display when the Button is clicked.")
- ]
- public string Msg
- {
- get
- {
- return _msg;
- }
- set
- {
- _msg = value;
- }
- }
- private void button1_Click(object sender, System.EventArgs e)
- {
- textBox1.Text = Msg;
- }
- }
- }
-