Example #1
0
        private void FormMain_Load(object sender, System.EventArgs e)
        {
            // Start with first item selected.
            cboxCountry.SelectedIndex = 0;

            // Create custom control using same attributes as designer control
            mytboxPostalCode          = new PostalCodeTextBox();
            mytboxPostalCode.Font     = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Regular);
            mytboxPostalCode.Location = tboxPostalCode.Location;
            mytboxPostalCode.Size     = tboxPostalCode.Size;
            mytboxPostalCode.Text     = tboxPostalCode.Text;
            //mytboxPostalCode.TextChanged += new System.EventHandler(this.tboxPostalCode_TextChanged);
            mytboxPostalCode.PostalCodeChanged += new EventHandler(mytboxPostalCode_PostalCodeChanged);

            // Delete designer control; add custom control
            Controls.Remove(tboxPostalCode);
            Controls.Add(mytboxPostalCode);
        }
Example #2
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 private void InitializeComponent()
 {
     this.mainMenu1         = new System.Windows.Forms.MainMenu();
     this.label1            = new System.Windows.Forms.Label();
     this.tboxName          = new System.Windows.Forms.TextBox();
     this.label2            = new System.Windows.Forms.Label();
     this.tboxAddr1         = new System.Windows.Forms.TextBox();
     this.tboxAddr2         = new System.Windows.Forms.TextBox();
     this.cboxCountry       = new System.Windows.Forms.ComboBox();
     this.label3            = new System.Windows.Forms.Label();
     this.label4            = new System.Windows.Forms.Label();
     this.tboxCity          = new System.Windows.Forms.TextBox();
     this.label5            = new System.Windows.Forms.Label();
     this.tboxStateProvince = new System.Windows.Forms.TextBox();
     this.cmdSave           = new System.Windows.Forms.Button();
     this.cmdClear          = new System.Windows.Forms.Button();
     this.mytboxPostalCode  = new Yao.Controls.PostalCodeTextBox();
     //
     // label1
     //
     this.label1.Font      = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Regular);
     this.label1.Location  = new System.Drawing.Point(8, 12);
     this.label1.Size      = new System.Drawing.Size(56, 20);
     this.label1.Text      = "Name:";
     this.label1.TextAlign = System.Drawing.ContentAlignment.TopRight;
     //
     // tboxName
     //
     this.tboxName.Font     = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Regular);
     this.tboxName.Location = new System.Drawing.Point(80, 8);
     this.tboxName.Size     = new System.Drawing.Size(144, 28);
     this.tboxName.Text     = "Mr. Our Visitor";
     //
     // label2
     //
     this.label2.Font      = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Regular);
     this.label2.Location  = new System.Drawing.Point(0, 44);
     this.label2.Size      = new System.Drawing.Size(72, 20);
     this.label2.Text      = "Address:";
     this.label2.TextAlign = System.Drawing.ContentAlignment.TopRight;
     //
     // tboxAddr1
     //
     this.tboxAddr1.Font     = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Regular);
     this.tboxAddr1.Location = new System.Drawing.Point(80, 40);
     this.tboxAddr1.Size     = new System.Drawing.Size(144, 28);
     this.tboxAddr1.Text     = "1212 Visitor Home Ave.";
     //
     // tboxAddr2
     //
     this.tboxAddr2.Font     = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Regular);
     this.tboxAddr2.Location = new System.Drawing.Point(80, 72);
     this.tboxAddr2.Size     = new System.Drawing.Size(144, 28);
     this.tboxAddr2.Text     = "Suite 12";
     //
     // cboxCountry
     //
     this.cboxCountry.Font = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Regular);
     this.cboxCountry.Items.Add("(Choose country)");
     this.cboxCountry.Items.Add("Canada");
     this.cboxCountry.Items.Add("Mexico");
     this.cboxCountry.Items.Add("Singapore");
     this.cboxCountry.Location              = new System.Drawing.Point(48, 104);
     this.cboxCountry.Size                  = new System.Drawing.Size(176, 29);
     this.cboxCountry.SelectedIndexChanged += new System.EventHandler(this.cboxCountry_SelectedIndexChanged);
     //
     // label3
     //
     this.label3.Font      = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Regular);
     this.label3.Location  = new System.Drawing.Point(16, 138);
     this.label3.Size      = new System.Drawing.Size(104, 24);
     this.label3.Text      = "Postal Code:";
     this.label3.TextAlign = System.Drawing.ContentAlignment.TopRight;
     //
     // label4
     //
     this.label4.Font      = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Regular);
     this.label4.Location  = new System.Drawing.Point(80, 170);
     this.label4.Size      = new System.Drawing.Size(40, 24);
     this.label4.Text      = "City:";
     this.label4.TextAlign = System.Drawing.ContentAlignment.TopRight;
     //
     // tboxCity
     //
     this.tboxCity.Font     = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Regular);
     this.tboxCity.Location = new System.Drawing.Point(128, 168);
     this.tboxCity.Size     = new System.Drawing.Size(96, 28);
     this.tboxCity.Text     = "";
     //
     // label5
     //
     this.label5.Font      = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Regular);
     this.label5.Location  = new System.Drawing.Point(0, 200);
     this.label5.Size      = new System.Drawing.Size(120, 20);
     this.label5.Text      = "State/Province:";
     this.label5.TextAlign = System.Drawing.ContentAlignment.TopRight;
     //
     // tboxStateProvince
     //
     this.tboxStateProvince.Font     = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Regular);
     this.tboxStateProvince.Location = new System.Drawing.Point(128, 200);
     this.tboxStateProvince.Size     = new System.Drawing.Size(96, 28);
     this.tboxStateProvince.Text     = "";
     //
     // cmdSave
     //
     this.cmdSave.Font     = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular);
     this.cmdSave.Location = new System.Drawing.Point(32, 232);
     this.cmdSave.Size     = new System.Drawing.Size(72, 32);
     this.cmdSave.Text     = "&Save";
     this.cmdSave.Click   += new System.EventHandler(this.cmdSave_Click);
     //
     // cmdClear
     //
     this.cmdClear.Font     = new System.Drawing.Font("Tahoma", 12F, System.Drawing.FontStyle.Regular);
     this.cmdClear.Location = new System.Drawing.Point(120, 232);
     this.cmdClear.Size     = new System.Drawing.Size(72, 32);
     this.cmdClear.Text     = "&Clear";
     this.cmdClear.Click   += new System.EventHandler(this.cmdClear_Click);
     //
     // mytboxPostalCode
     //
     this.mytboxPostalCode.AllowLetters       = false;
     this.mytboxPostalCode.AllowSpace         = false;
     this.mytboxPostalCode.Font               = new System.Drawing.Font("Tahoma", 10F, System.Drawing.FontStyle.Regular);
     this.mytboxPostalCode.Location           = new System.Drawing.Point(128, 136);
     this.mytboxPostalCode.Size               = new System.Drawing.Size(56, 28);
     this.mytboxPostalCode.Text               = "";
     this.mytboxPostalCode.PostalCodeChanged += new System.EventHandler(this.mytboxPostalCode_PostalCodeChanged);
     //
     // FormMain
     //
     this.Controls.Add(this.mytboxPostalCode);
     this.Controls.Add(this.cmdClear);
     this.Controls.Add(this.cmdSave);
     this.Controls.Add(this.tboxStateProvince);
     this.Controls.Add(this.label5);
     this.Controls.Add(this.tboxCity);
     this.Controls.Add(this.label4);
     this.Controls.Add(this.label3);
     this.Controls.Add(this.cboxCountry);
     this.Controls.Add(this.tboxAddr2);
     this.Controls.Add(this.tboxAddr1);
     this.Controls.Add(this.label2);
     this.Controls.Add(this.tboxName);
     this.Controls.Add(this.label1);
     this.Menu        = this.mainMenu1;
     this.MinimizeBox = false;
     this.Text        = "MyAddress";
     this.Load       += new System.EventHandler(this.FormMain_Load);
 }