TextBox Demo

image_pdfimage_print


   

/*
Professional Windows GUI Programming Using C#
by Jay Glynn, Csaba Torok, Richard Conway, Wahid Choudhury, 
   Zach Greenvoss, Shripad Kulkarni, Neil Whitlow

Publisher: Peer Information
ISBN: 1861007663
*/
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;

namespace TextBox
{
    /// <summary>
    /// Summary description for TextBox.
    /// </summary>
    public class TextBox : System.Windows.Forms.Form
    {
        private System.Windows.Forms.Label label1;
        private System.Windows.Forms.Label label2;
        private System.Windows.Forms.Label label3;
        private System.Windows.Forms.Label label4;
        private System.Windows.Forms.TextBox SINGLE_LINE;
        private System.Windows.Forms.TextBox PASSWORD_LINE;
        private System.Windows.Forms.TextBox MULTI_LINE;
        private System.Windows.Forms.RichTextBox RICH_EDIT;
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.Container components = null;

        public TextBox()
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            //
            // TODO: Add any constructor code after InitializeComponent 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 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.SINGLE_LINE = new System.Windows.Forms.TextBox();
            this.label1 = new System.Windows.Forms.Label();
            this.PASSWORD_LINE = new System.Windows.Forms.TextBox();
            this.label2 = new System.Windows.Forms.Label();
            this.label3 = new System.Windows.Forms.Label();
            this.MULTI_LINE = new System.Windows.Forms.TextBox();
            this.RICH_EDIT = new System.Windows.Forms.RichTextBox();
            this.label4 = new System.Windows.Forms.Label();
            this.SuspendLayout();
            // 
            // SINGLE_LINE
            // 
            this.SINGLE_LINE.CharacterCasing = System.Windows.Forms.CharacterCasing.Upper;
            this.SINGLE_LINE.ForeColor = System.Drawing.Color.FromArgb(((System.Byte)(128)), ((System.Byte)(64)), ((System.Byte)(64)));
            this.SINGLE_LINE.Location = new System.Drawing.Point(32, 40);
            this.SINGLE_LINE.Name = "SINGLE_LINE";
            this.SINGLE_LINE.Size = new System.Drawing.Size(408, 20);
            this.SINGLE_LINE.TabIndex = 0;
            this.SINGLE_LINE.Text = "THIS IS A SINGLELINE EDIT CONTROL";
            // 
            // label1
            // 
            this.label1.Location = new System.Drawing.Point(32, 24);
            this.label1.Name = "label1";
            this.label1.Size = new System.Drawing.Size(168, 16);
            this.label1.TabIndex = 1;
            this.label1.Text = "Single Line TextBox";
            // 
            // PASSWORD_LINE
            // 
            this.PASSWORD_LINE.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.PASSWORD_LINE.Location = new System.Drawing.Point(32, 104);
            this.PASSWORD_LINE.Name = "PASSWORD_LINE";
            this.PASSWORD_LINE.PasswordChar = &#039;^&#039;;
            this.PASSWORD_LINE.Size = new System.Drawing.Size(104, 22);
            this.PASSWORD_LINE.TabIndex = 2;
            this.PASSWORD_LINE.Text = "";
            // 
            // label2
            // 
            this.label2.Location = new System.Drawing.Point(32, 80);
            this.label2.Name = "label2";
            this.label2.Size = new System.Drawing.Size(160, 16);
            this.label2.TabIndex = 3;
            this.label2.Text = "Password TextBox";
            // 
            // label3
            // 
            this.label3.Location = new System.Drawing.Point(32, 136);
            this.label3.Name = "label3";
            this.label3.Size = new System.Drawing.Size(120, 16);
            this.label3.TabIndex = 4;
            this.label3.Text = "MultiLine TextBox";
            // 
            // MULTI_LINE
            // 
            this.MULTI_LINE.AcceptsReturn = true;
            this.MULTI_LINE.AcceptsTab = true;
            this.MULTI_LINE.Font = new System.Drawing.Font("Microsoft Sans Serif", 9.75F, (System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic), System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.MULTI_LINE.ForeColor = System.Drawing.SystemColors.HotTrack;
            this.MULTI_LINE.Location = new System.Drawing.Point(32, 160);
            this.MULTI_LINE.MaxLength = 10000;
            this.MULTI_LINE.Multiline = true;
            this.MULTI_LINE.Name = "MULTI_LINE";
            this.MULTI_LINE.ScrollBars = System.Windows.Forms.ScrollBars.Vertical;
            this.MULTI_LINE.Size = new System.Drawing.Size(408, 104);
            this.MULTI_LINE.TabIndex = 5;
            this.MULTI_LINE.Text = "";
            // 
            // RICH_EDIT
            // 
            this.RICH_EDIT.Font = new System.Drawing.Font("Verdana", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0)));
            this.RICH_EDIT.ForeColor = System.Drawing.Color.Red;
            this.RICH_EDIT.Location = new System.Drawing.Point(32, 296);
            this.RICH_EDIT.Name = "RICH_EDIT";
            this.RICH_EDIT.ShowSelectionMargin = true;
            this.RICH_EDIT.Size = new System.Drawing.Size(408, 120);
            this.RICH_EDIT.TabIndex = 6;
            this.RICH_EDIT.Text = "richTextBox1";
            this.RICH_EDIT.ZoomFactor = 4.999695F;
            // 
            // label4
            // 
            this.label4.Location = new System.Drawing.Point(32, 272);
            this.label4.Name = "label4";
            this.label4.Size = new System.Drawing.Size(152, 16);
            this.label4.TabIndex = 7;
            this.label4.Text = "RichEdit Text Box";
            // 
            // TextBox
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(464, 453);
            this.Controls.AddRange(new System.Windows.Forms.Control[] {
                                                                          this.label4,
                                                                          this.RICH_EDIT,
                                                                          this.MULTI_LINE,
                                                                          this.label3,
                                                                          this.label2,
                                                                          this.PASSWORD_LINE,
                                                                          this.label1,
                                                                          this.SINGLE_LINE});
            this.Name = "TextBox";
            this.Text = "TextBox Controls";
            this.Load += new System.EventHandler(this.TextBox_Load);
            this.ResumeLayout(false);

        }
        #endregion

        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main() 
        {
            Application.Run(new TextBox());
        }

        private void TextBox_Load(object sender, System.EventArgs e)
        {
            RICH_EDIT.LoadFile("c:	empRTFDOC.RTF");     
        }
    }
}