论坛首页 编程语言技术论坛

IPBoxControl 开发手记(二)

浏览 2361 次
精华帖 (0) :: 良好帖 (0) :: 新手帖 (0) :: 隐藏帖 (0)
作者 正文
   发表时间:2008-12-24   最后修改:2009-01-05

    如果哪位发现什么问题和bug,请多多指出,我会及时修改。谢谢!

/**//*
 * Purpose: IPAddress TextBox Control.
 * Author: Vincent
 * Date: 2004-10-29
 *
 
*/


using System;
using System.Windows.Forms;

namespace Sci.Vincent.Controls
{
    
/**//// <summary>
    
/// IP Address Box Control.
    
/// </summary>
    public class IPBox : System.Windows.Forms.UserControl
    
{
        
private System.Windows.Forms.TextBox textBox1;
        
private System.Windows.Forms.Label label1;
        
private System.Windows.Forms.Label label2;
        
private System.Windows.Forms.TextBox textBox2;
        
private System.Windows.Forms.Label label3;
        
private System.Windows.Forms.TextBox textBox3;
        
private System.Windows.Forms.TextBox textBox4;

        
/**//// <summary>
        
/// Required designer variable.
        
/// </summary>
        private System.ComponentModel.Container components = null;

        
private System.Windows.Forms.Panel panel1;

        
private const int DEFAULT_WIDTH_SIZE = 136;
        
private const int DEFAULT_HEIGHT_SIZE = 20;
        
private string _text = "";
        
private bool _isAllowWarn = true;
        
private Languages _language = Languages.English;

        
/**//// <summary>
        
/// Usable languages enumeration.
        
/// </summary>
        public enum Languages
        
{
            
/**//// <summary>
            
/// English language
            
/// </summary>
            English,
            
/**//// <summary>
            
/// Chinese language
            
/// </summary>
            Chinese
        }



        
/**//// <summary>
        
/// Creates an instance of the IPBox class.
        
/// </summary>
        public IPBox()
        
{
            
// This call is required by the Windows.Forms Form Designer.
            InitializeComponent();

            
// TODO: Add any initialization after the InitComponent 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);
        }


        
Component Designer generated code#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.label1 = new System.Windows.Forms.Label();
            
this.label2 = new System.Windows.Forms.Label();
            
this.textBox2 = new System.Windows.Forms.TextBox();
            
this.label3 = new System.Windows.Forms.Label();
            
this.textBox3 = new System.Windows.Forms.TextBox();
            
this.textBox4 = new System.Windows.Forms.TextBox();
            
this.panel1 = new System.Windows.Forms.Panel();
            
this.panel1.SuspendLayout();
            
this.SuspendLayout();
            
// 
            
// textBox1
            
// 
            this.textBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
            
this.textBox1.Location = new System.Drawing.Point(80);
            
this.textBox1.MaxLength = 3;
            
this.textBox1.Name = "textBox1";
            
this.textBox1.Size = new System.Drawing.Size(2013);
            
this.textBox1.TabIndex = 0;
            
this.textBox1.Text = "";
            
this.textBox1.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            
this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
            
// 
            
// label1
            
// 
            this.label1.BackColor = System.Drawing.SystemColors.Window;
            
this.label1.Location = new System.Drawing.Point(320);
            
this.label1.Name = "label1";
            
this.label1.Size = new System.Drawing.Size(814);
            
this.label1.TabIndex = 1;
            
this.label1.Text = ".";
            
this.label1.TextAlign = System.Drawing.ContentAlignment.TopCenter;
            
// 
            
// label2
            
// 
            this.label2.BackColor = System.Drawing.SystemColors.Window;
            
this.label2.Location = new System.Drawing.Point(640);
            
this.label2.Name = "label2";
            
this.label2.Size = new System.Drawing.Size(814);
            
this.label2.TabIndex = 3;
            
this.label2.Text = ".";
            
this.label2.TextAlign = System.Drawing.ContentAlignment.TopCenter;
            
// 
            
// textBox2
            
// 
            this.textBox2.BorderStyle = System.Windows.Forms.BorderStyle.None;
            
this.textBox2.Location = new System.Drawing.Point(400);
            
this.textBox2.MaxLength = 3;
            
this.textBox2.Name = "textBox2";
            
this.textBox2.Size = new System.Drawing.Size(2013);
            
this.textBox2.TabIndex = 2;
            
this.textBox2.Text = "";
            
this.textBox2.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            
this.textBox2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox2_KeyPress);
            
// 
            
// label3
            
// 
            this.label3.BackColor = System.Drawing.SystemColors.Window;
            
this.label3.Location = new System.Drawing.Point(960);
            
this.label3.Name = "label3";
            
this.label3.Size = new System.Drawing.Size(814);
            
this.label3.TabIndex = 5;
            
this.label3.Text = ".";
            
this.label3.TextAlign = System.Drawing.ContentAlignment.TopCenter;
            
// 
            
// textBox3
            
// 
            this.textBox3.BorderStyle = System.Windows.Forms.BorderStyle.None;
            
this.textBox3.Location = new System.Drawing.Point(720);
            
this.textBox3.MaxLength = 3;
            
this.textBox3.Name = "textBox3";
            
this.textBox3.Size = new System.Drawing.Size(2013);
            
this.textBox3.TabIndex = 4;
            
this.textBox3.Text = "";
            
this.textBox3.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            
this.textBox3.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox3_KeyPress);
            
// 
            
// textBox4
            
// 
            this.textBox4.BorderStyle = System.Windows.Forms.BorderStyle.None;
            
this.textBox4.Location = new System.Drawing.Point(1040);
            
this.textBox4.MaxLength = 3;
            
this.textBox4.Name = "textBox4";
            
this.textBox4.Size = new System.Drawing.Size(2013);
            
this.textBox4.TabIndex = 6;
            
this.textBox4.Text = "";
            
this.textBox4.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
            
this.textBox4.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox4_KeyPress);
            
// 
            
// panel1
            
// 
            this.panel1.BackColor = System.Drawing.SystemColors.Window;
            
this.panel1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
      &
论坛首页 编程语言技术版

跳转论坛:
Global site tag (gtag.js) - Google Analytics