C# Create a Dynamic Menu With Textboxes

C# Create a Dynamic Menu With Textboxes

                                                                                                                                                                  

in this c# tutorial we will see how to make a Dynamic Menu using TextBoxes with C# .
components used "TextBoxes"and  "timer".



an example of a single TextBox.

Project Source Code :

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Threading;

namespace Something
{
    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }
        int t1 = 76;

private void timer1_Tick(object sender, EventArgs e)
        {
            if (t1 > 176)
            {
                timer1.Stop();
                this.textBox1.BorderStyle = BorderStyle.FixedSingle;
            }
            else
            {
                this.textBox1.Size = new Size(t1, this.textBox1.Size.Height);
                t1+=2;
            } 

        }

        private void textBox1_MouseHover(object sender, EventArgs e)
        {
            timer1.Start();
        }

private void textBox1_MouseLeave(object sender, EventArgs e)
        {
            timer1.Stop();
            t1 = 76;
            this.textBox1.Size = new Size(t1, this.textBox1.Size.Height);
            this.textBox1.BorderStyle = BorderStyle.None;
        }

private void textBox1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("something");
        }
    }
}

////////////////////////////////// END


Share this

Related Posts

Previous
Next Post »