密码文本框显示密钥char一段时间,然后将该字符隐藏为密码char [英] Password textbox showing key char for some time then hidding that char to password char

查看:81
本文介绍了密码文本框显示密钥char一段时间,然后将该字符隐藏为密码char的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我需要帮助.

我有一个文本框,它是一个密码文本框..

我使用此代码隐藏了用户输入的所有字符..

textBox1.UseSystemPasswordChar = True;

但是

我需要的是..

当用户在该密码文本框中输入任何字符时,输入的字符(仅该字符)必须显示一段时间(以及其他字符,但其他字符必须使用密码char隐藏)一段时间,然后隐藏所有使用密码char ..的字符. br/>

我该怎么解决...

我完全是空白..

Hai all,

I need a help..

I have a textbox which is a password textbox..

I used this code to hide all the char''s that the user enters..

textBox1.UseSystemPasswordChar = True;

But

What I need is..

when user enters any char to that password textbox, the entered char(only that char) must show (along with other char, but other chars must be hidden with password char) for some time and then hide all chars with password char..


How can I solve this...

I am totally blank..

推荐答案

FYI

Silverlight密码框 [
FYI

Silverlight Password Box[^]

string _currentText = "";
        void textBox1_TextChanged(object sender, EventArgs e)
        {
            TextBox __textBox = sender as TextBox;
            if (__textBox != null)
            {
                string __currentText = __textBox.Text;
                if (__currentText.Length < _currentText.Length)
                    _currentText = _currentText.Substring(0, __currentText.Length);
                if (__currentText != "")
                {
                    for (int i = 0; i < __currentText.Length; i++)
                    {
                        if (__currentText[i] != '\u25CF')
                        {
                            System.Threading.Thread.Sleep(100); // Can change the time to make character visible
                            string __temp = __currentText.Remove(i, 1);
                            __textBox.Text = __temp.Insert(i, "\u25CF");
                            _currentText = _currentText.Insert
                    (_currentText.Length, __currentText[i].ToString());
                        }
                    }
                }
            }
        }


这篇关于密码文本框显示密钥char一段时间,然后将该字符隐藏为密码char的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆