如题。在winform中实现,请大大们指教!

解决方案 »

  1.   

    <asp:TextBox ID="TextBox2" runat="server"  Text="所有我编辑的信息"  class="TopText"
              onFocus="if(this.value=='所有我编辑的信息'){this.value='';}this.select();" Height="21px"></asp:TextBox>
      

  2.   

    winform有没有获得失去焦点的事件呢?
      

  3.   

    设置TextBox有默认文字
    private void textBox1_Click(object sender, EventArgs e)
            {
                this.textBox1.Text = "";
            }
      

  4.   

     private void Form1_Load(object sender, EventArgs e)
            {
                textBox1.Text = "请在此输入内容";
            }        private void textBox1_Click(object sender, EventArgs e)
            {
                textBox1.Text = "";
            }
      

  5.   

            
            private void textBox1_MouseClick(object sender, MouseEventArgs e)
            {
                textBox1.Text = "";
            }
      

  6.   

    http://blog.csdn.net/manimanihome/archive/2008/02/27/2125073.aspx
      

  7.   

    <asp:TextBox ID="TextBox1" runat="server" Text="编辑信息"
      onFocus="if(this.value=='编辑信息'){this.value='';}this.select();"> <asp:TextBox>
      

  8.   

    在winform的构造函数里设置默认文字
    this.textBox1.Text="默认文字";添加一个mouseClick事件 
    private void textBox1_MouseClick(object sender, MouseEventArgs e)
    {
       textBox1.Text = "";
    }
      

  9.   


    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;namespace winTest
    {
        public partial class Form1 : Form
        {
            public Form1()
            {
                InitializeComponent();
            }        private void Form1_Load(object sender, EventArgs e)
            {
                textBox1.Text = "请输入您的银行账号与密码,用#隔开";
                textBox1.Tag = 0;
                textBox1.ForeColor = Color.Silver;
                label1.Focus();
            }        private void textBox1_MouseLeave(object sender, EventArgs e)
            {
                if (textBox1.Text.Trim().Length == 0 || Convert.ToInt32(textBox1.Tag) == 0)
                {
                    textBox1.Text = "请输入您的银行账号与密码,用#隔开";
                    textBox1.Tag = 0;
                    textBox1.ForeColor = Color.Silver;
                }
                label1.Focus();
            }        private void textBox1_MouseDown(object sender, MouseEventArgs e)
            {
                if (Convert.ToInt32(textBox1.Tag) == 0)
                {
                    textBox1.Text = "";
                    textBox1.Tag = 1;
                }
            }        private void textBox1_TextChanged(object sender, EventArgs e)
            {
                if (Convert.ToInt32(textBox1.Tag) == 1)
                {
                    textBox1.ForeColor = Color.Black;
                }
            }
        }
    }
    //写的不好 ,将就能用
      

  10.   

    最好是继承TextBox重写一个类
    参考
      

  11.   

    设置属性Text = 默认值;
       private void textBox1_MouseHover(object sender, EventArgs e)
            {
                textBox1.Text = null;
            }