panel面板

View 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;

namespace 面板
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void label2_Click(object sender, EventArgs e)
        {
            textBox1.Text += "1";
        }

        private void label3_Click(object sender, EventArgs e)
        {
            textBox1.Text += "2";
        }

        private void label4_Click(object sender, EventArgs e)
        {
            try
            {
                textBox1.Text = textBox1.Text.Substring(0, textBox1.Text.Length - 1);

            }
            catch
            {
             //   textBox1.Text = "内容已经空";
            }
        }

        private void label1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text == null)
            {
                MessageBox.Show("请输入内容");
            }
            else
            {
                MessageBox.Show("您输入的内容为"+textBox1.Text);
            }
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            textBox1.SelectionStart = textBox1.Text.Length;
        }

        private void button1_MouseEnter(object sender, EventArgs e)
        {
            label5.Text = "进入按钮";
        }

        private void button1_MouseLeave(object sender, EventArgs e)
        {
            label5.Text = "离开按钮";
        }

        
    }
}

 textBox1.Text = textBox1.Text.Substring(0, textBox1.Text.Length - 1);

posted on 2013-05-13 10:37  杨柳清枫2012  阅读(126)  评论(0)    收藏  举报

导航