c#仿照qq登录界面编辑框内容操作

 1 using System;
 2 using System.Drawing;
 3 using System.Windows.Forms;
 4 
 5 namespace 案例演示
 6 {
 7 public partial class frmlogo : Form
 8 {
 9 public frmlogo()
10 {
11 InitializeComponent();
12 }
13 int usi,pwi;
14 private void frmlogo_Load(object sender, EventArgs e)
15 {
16 
17 }
18 
19 private void textBox1_MouseDown(object sender, MouseEventArgs e)
20 {
21 usi++;
22 if (usi==1)
23 {
24 textBox1.Text = ""; 
25 }
26 if (textBox2.Text=="")
27 {
28 pwi = 0;
29 textBox2.Text = "密码";
30 }
31 
32 
33 }
34 
35 private void textBox2_MouseDown(object sender, MouseEventArgs e)
36 {
37 pwi++;
38 if (textBox1.Text=="")
39 {
40 textBox1.Text = "用户名";
41 usi = 0;
42 }
43 if (pwi==1)
44 {
45 textBox2.Text = "";
46 }
47 }
48 
49 private void textBox1_KeyDown(object sender, KeyEventArgs e)
50 {
51 textBox1.ForeColor = Color.Black; 
52 }
53 
54 private void textBox2_KeyDown(object sender, KeyEventArgs e)
55 {
56 textBox2.ForeColor = Color.Black;
57 }
58 
59 private void button1_Click(object sender, EventArgs e)
60 {
61 
62 }
63 }
64 }
65 
66 2017-09-02

 

转载于:https://www.cnblogs.com/enych/p/7466419.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值