zoukankan      html  css  js  c++  java
  • 在文本框的特定位置用*号替换 分类: .NET 20120428 11:13 493人阅读 评论(1) 收藏

    效果:



    代码:

    private void textBox1_TextChanged(object sender, EventArgs e)
            {
                string content = this.textBox1.Text;
                int length = content.Length;
                if(length>=5 && length<=7)
                {
                    string temp = "";
                    if(length == 5)
                    {
                        temp = content.Replace(content.Substring(4, 1), "*");    
                    }else if(length == 6)
                    {
                        temp = content.Replace(content.Substring(5, 1), "*");    
                    }else if(length == 7)
                    {
                        temp = content.Replace(content.Substring(6, 1), "*");    
                    }
                    this.textBox1.Text = temp;
                    textBox1.SelectionStart = textBox1.TextLength;//设置文本框选定的文本起点
                }
            }


    版权声明:本文为博主原创文章,未经博主允许不得转载。

  • 相关阅读:
    ARM IIC接口
    ARM硬件问题转载
    自动排版
    书签
    ARM硬件问题转载
    ATPCS规则1
    开发硬件所需的知识
    今天很崩溃呀
    回顾一下
    ARM汇编条件码
  • 原文地址:https://www.cnblogs.com/configman/p/4657589.html
Copyright © 2011-2022 走看看