using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms; namespace TextBox_1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
} private void Form1_Load(object sender, EventArgs e)
{
textBox1.PasswordChar = '@'; //设置文本框的PasswordChar属性为字符@
textBox2.UseSystemPasswordChar = true;
//设置文本框的UseSystemPasswordChar属性为True;
} private void label1_Click(object sender, EventArgs e)
{ }
}
}

program.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms; namespace TextBox_1
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
//Enabled 获取或设置一个值,该值指示控件能否够对用户交互做出响应
//ForeColor:获取或设置控件的前景色
//Modifiers:指示TextBox控件的可见性级别
//Multiline://获取或设置字符,该字符用于
//PasswordChar:获取或设置字符
// :public char PasswordChar{get; set;}
//ReadOnly:获取或设置一个值,该值指示文本框中的文本是否为仅仅读
// :public bool ReadOnly{get ; set; }
// :TextBox.ReadOnly=true; 将文本设置为仅仅读
//RightToLeft:获取或设置一个值.该值指示是否将控件的元素对齐以支持使用从右向左的字体区域设置
//ScrollBars:获取或设置哪些滚动栏应出如今多行TextBox控件中
//Text:获取或设置TextBox控件的文本
//UseSystemPasswordChar:获取或设置一个值,该值指示TextBox控件中的文本是否应该以默认的password字符显示
// :public Bool UseSystemPasswordChar{get ;set ;}
//Visible:获取或设置一个值,该值指示是否显示该控件及其全部父控件
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1()); }
}
}

Form设计:

namespace TextBox_1
{
partial class Form1
{
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.IContainer components = null; /// <summary>
/// 清理全部正在使用的资源。
/// </summary>
/// <param name="disposing">假设应释放托管资源,为 true。否则为 false。 </param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
} #region Windows 窗口设计器生成的代码 /// <summary>
/// 设计器支持所需的方法 - 不要
/// 使用代码编辑器改动此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.textBox1 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(155, 27);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(121, 21);
this.textBox1.TabIndex = 0;
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(155, 77);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(121, 21);
this.textBox2.TabIndex = 1;
//
// label1
//
this.label1.AutoSize = true;
this.label1.Location = new System.Drawing.Point(66, 30);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(83, 12);
this.label1.TabIndex = 2;
this.label1.Text = "PassWordChar:";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(12, 80);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(137, 12);
this.label2.TabIndex = 3;
this.label2.Text = "UseSystemPassWordChar:";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(318, 151);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.textBox1);
this.Name = "Form1";
this.Text = "登录";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
this.PerformLayout(); } #endregion private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
}
}

watermark/2/text/aHR0cDovL2Jsb2cuY3Nkbi5uZXQvc2hpbmVwYW4=/font/5a6L5L2T/fontsize/400/fill/I0JBQkFCMA==/dissolve/70/gravity/Center" alt="">

版权声明:本文博客原创文章。博客,未经同意,不得转载。

C#-TextBox-登录表单password无形---ShinePans的更多相关文章

  1. 用JS动态创建登录表单,报了个小错误

    后来发现原来是: dvObj.style.border='#Red 1px sold'; 其中的Red多谢了一个‘#’, 但是奇怪的是在chrome和firefox都备有报错,但是在ie中报错了. 各 ...

  2. yii YII小部件 创建登录表单表单 Login表单

    YII框架必须遵循其表单的创建方法 登录模型错做与数据库操作模型是一致的,不同的是不跟数据库交互 ,用的是小部件,在创建表单之前,要在用户控制模块完成以下代码 protected --models - ...

  3. Yii创建前台和后台登录表单和通过扩展 CWebUser 增加信息到 Yii::app()->user

    我参考了这篇文章来构建项目的前台和后台的目录结构.感谢Andy的这篇文章.按照所有的步骤,您将有单独的前台和后台面板,如: http://localhost/index.php // 前台 http: ...

  4. CSS3/HTML5实现漂亮的分步骤注册登录表单

    分步骤的登录注册表单现在也比较多,主要是能提高用户体验,用户可以有选择性的填写相应的表单信息,不至于让用户看到一堆表单望而却步.今天和大家分享的就是一款基于HTML5和CSS3的分步骤注册登录表单,外 ...

  5. 很酷的CSS3仿Facebook登录表单

    原文:很酷的CSS3仿Facebook登录表单 今天看到一款很不错的CSS3登录表单,外观是仿Facebook的登录表单,还挺不错的,另外也支持简单的表单输入框验证.下图是表单的效果图: 我们也可以在 ...

  6. Spring Security默认的用户登录表单 页面源代码

    Spring Security默认的用户登录表单 页面源代码 <html><head><title>Login Page</title></hea ...

  7. xml实现登录表单验证

    定义: XML(eXtended Markup Language,可扩展标记语言)提供了一套跨平台.跨网络.跨程序的语言的数据描述方式,使用XML可以方便地实现数据交换.系统配置.内容管理等常见功能. ...

  8. AngularJS学习之 登录表单 清爽验证(边学边更新)

    注册过程的确好多需要验证的,但是注册成功之后的登录就简单多了, 只要用户 输入 用户名和密码, ajax向后台提交登录请求, 根据返回的结果确定用户名或者密码是否正确即可登录. 所以这个登录表单的验证 ...

  9. Vue + ElementUI的电商管理系统实例01 登录表单

    效果图: 1.首先来根据Element网站实现布局: <template> <div class="login_container"> <div cl ...

随机推荐

  1. mongodb 学习笔记05 --用户管理

    csdn的markdown编辑器真有够烂的,这篇文章又给弄丢了 启用认证 mongod 启动默认没有开启权限,你须要指定 –auth 启动.或者在配置文件里设置security.authorizati ...

  2. oracle db于,一个特定的数据字典pct miss其计算公式

    这篇文章是原创文章,转载请注明出处: http://blog.csdn.net/msdnchina/article/details/38766801 本文提到的数据字典.以dc_histogram_d ...

  3. cocos2dx-2.x CCFileUtils文件管理分析(2)

    于1于,我只是对整体结构进行了分析,然后,2于,我会在一些我们经常使用的分析功能. //获取给定文件名称的全路径 //以下这非常长一段凝视.通过举样例,像我们说明cocos2dx获取文件全路径的规则. ...

  4. Android - 和其他APP交互 - 获得activity的返回值

    启用另一个activity不一定是单向的.也可以启用另一个activity并且获得返回值.要获得返回值的话,调用startActivityForResult()(而不是startActivity()) ...

  5. [站点部署_01]wordpress建站网页响应速度慢

    最近可能非常多人发现站点打开速度变慢.这里分享一下该问题的定位方法. 我在本地部署了一个wordpress站点,近几天突然发现站点訪问速度奇慢,实在不能忍.于是採用例如以下方法攻克了这个问题: 1)使 ...

  6. 【最小割】HDU 4971 A simple brute force problem.

    说是最大权闭合图.... 比赛时没敢写.... 题意 一共同拥有n个任务,m个技术 完毕一个任务可盈利一些钱,学习一个技术要花费钱 完毕某个任务前须要先学习某几个技术 可是可能在学习一个任务前须要学习 ...

  7. JSON连载java目的

    一. 前台(JS  面向对象) 1. 定义SearchView对象 function SearchView() { } SearchView.prototype.setViewName = funct ...

  8. [Android 4.4.4] 泛泰A870 通过刷第三版 Mokee4.4.4 KTU84P 20140626 RC2.1 by syhost

    主题及注意事项请访问以前的版本: http://blog.csdn.net/syhost/article/details/29931291 此RC2.1版比RC2.0改进的地方: 1. Mokee本身 ...

  9. struts2于validate要使用

    package com.test.action; import com.opensymphony.xwork2.ActionSupport; import com.test.model.User; p ...

  10. Hadoop处理HDF文件

    1.前言 HDF文件是遥感应用中一种常见的数据格式,因为其高度结构化的特点,笔者曾被怎样使用Hadoop处理HDF文件这个问题困扰过相当长的一段时间.于是Google各种解决方式,但都没有找到一种理想 ...