Click here to Skip to main content
15,887,214 members
Articles / Programming Languages / C#

A C# IP Address Control

Rate me:
Please Sign up or sign in to vote.
4.72/5 (98 votes)
28 Apr 2008MIT4 min read 785.5K   39.8K   297  
A C# analogue to the MFC CIPAddressCtrl
namespace TestIPAddressControl
{
   partial class Form1
   {
      /// <summary>
      /// Required designer variable.
      /// </summary>
      private System.ComponentModel.IContainer components = null;

      /// <summary>
      /// Clean up any resources being used.
      /// </summary>
      /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
      protected override void Dispose( bool disposing )
      {
         if ( disposing && ( components != null ) )
         {
            components.Dispose();
         }
         base.Dispose( disposing );
      }

      #region Windows Form 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.label1 = new System.Windows.Forms.Label();
         this.label2 = new System.Windows.Forms.Label();
         this._ipAddressControl = new IPAddressControlLib.IPAddressControl();
         this._ipAddressControlLocal = new IPAddressControlLib.IPAddressControl();
         this.SuspendLayout();
         // 
         // label1
         // 
         this.label1.AutoSize = true;
         this.label1.Location = new System.Drawing.Point( 41, 15 );
         this.label1.Name = "label1";
         this.label1.Size = new System.Drawing.Size( 61, 13 );
         this.label1.TabIndex = 0;
         this.label1.Text = "IP Address:";
         this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
         // 
         // label2
         // 
         this.label2.AutoSize = true;
         this.label2.Location = new System.Drawing.Point( 12, 41 );
         this.label2.Name = "label2";
         this.label2.Size = new System.Drawing.Size( 90, 13 );
         this.label2.TabIndex = 1;
         this.label2.Text = "Local IP Address:";
         this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
         // 
         // _ipAddressControl
         // 
         this._ipAddressControl.AllowInternalTab = false;
         this._ipAddressControl.AutoHeight = true;
         this._ipAddressControl.BackColor = System.Drawing.SystemColors.Window;
         this._ipAddressControl.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
         this._ipAddressControl.Cursor = System.Windows.Forms.Cursors.IBeam;
         this._ipAddressControl.Location = new System.Drawing.Point( 108, 12 );
         this._ipAddressControl.MinimumSize = new System.Drawing.Size( 87, 20 );
         this._ipAddressControl.Name = "_ipAddressControl";
         this._ipAddressControl.ReadOnly = false;
         this._ipAddressControl.Size = new System.Drawing.Size( 100, 20 );
         this._ipAddressControl.TabIndex = 2;
         this._ipAddressControl.Text = "...";
         // 
         // _ipAddressControlLocal
         // 
         this._ipAddressControlLocal.AllowInternalTab = false;
         this._ipAddressControlLocal.AutoHeight = true;
         this._ipAddressControlLocal.BackColor = System.Drawing.SystemColors.Window;
         this._ipAddressControlLocal.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
         this._ipAddressControlLocal.Cursor = System.Windows.Forms.Cursors.IBeam;
         this._ipAddressControlLocal.Location = new System.Drawing.Point( 108, 38 );
         this._ipAddressControlLocal.MinimumSize = new System.Drawing.Size( 87, 20 );
         this._ipAddressControlLocal.Name = "_ipAddressControlLocal";
         this._ipAddressControlLocal.ReadOnly = true;
         this._ipAddressControlLocal.Size = new System.Drawing.Size( 100, 20 );
         this._ipAddressControlLocal.TabIndex = 3;
         this._ipAddressControlLocal.Text = "...";
         // 
         // Form1
         // 
         this.AutoScaleDimensions = new System.Drawing.SizeF( 6F, 13F );
         this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
         this.ClientSize = new System.Drawing.Size( 287, 74 );
         this.Controls.Add( this._ipAddressControlLocal );
         this.Controls.Add( this._ipAddressControl );
         this.Controls.Add( this.label2 );
         this.Controls.Add( this.label1 );
         this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
         this.Name = "Form1";
         this.Text = "TestIPAddressControl";
         this.Load += new System.EventHandler( this.Form1_Load );
         this.ResumeLayout( false );
         this.PerformLayout();

      }

      #endregion

      private System.Windows.Forms.Label label1;
      private System.Windows.Forms.Label label2;
      private IPAddressControlLib.IPAddressControl _ipAddressControl;
      private IPAddressControlLib.IPAddressControl _ipAddressControlLocal;
   }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The MIT License


Written By
Canada Canada
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions