如题。在winform中实现,请大大们指教!
解决方案 »
- 分享:C# 连连看源代码(丰富音乐及图片)转自51CTO
- 高分相询:怎样取得一个播放器的播放时间?????
- 怎么建立和datagridview的连接?
- 和RichTextBox 的Undo()和SelectionAlignment属性相关
- windows moblie拨号
- 工具箱里面那个树形的展开是怎么做的 就是 公共控件 ,一点击属于这个大项的子项控件就显示出来了
- 字符串问题,急!!!!!
- 窗体的调用
- C#捕捉指定网站的访问IP
- 这种报错是什么意思啊?
- ERROR [HY000] [Microsoft][ODBC Microsoft Access Driver] 操作必须使用一个可更新的查询。
- C# Winform里面能用WebService吗?
onFocus="if(this.value=='所有我编辑的信息'){this.value='';}this.select();" Height="21px"></asp:TextBox>
private void textBox1_Click(object sender, EventArgs e)
{
this.textBox1.Text = "";
}
{
textBox1.Text = "请在此输入内容";
} private void textBox1_Click(object sender, EventArgs e)
{
textBox1.Text = "";
}
private void textBox1_MouseClick(object sender, MouseEventArgs e)
{
textBox1.Text = "";
}
onFocus="if(this.value=='编辑信息'){this.value='';}this.select();"> <asp:TextBox>
this.textBox1.Text="默认文字";添加一个mouseClick事件
private void textBox1_MouseClick(object sender, MouseEventArgs e)
{
textBox1.Text = "";
}
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;
}
}
}
}
//写的不好 ,将就能用
参考
private void textBox1_MouseHover(object sender, EventArgs e)
{
textBox1.Text = null;
}