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. (转)Maven最佳实践:划分模块

    “分天下为三十六郡,郡置守,尉,监” —— <史记·秦始皇本纪> 所有用Maven管理的真实的项目都应该是分模块的,每个模块都对应着一个pom.xml.它们之间通过继承和聚合(也称作多模块 ...

  2. BEGINNING SHAREPOINT&#174; 2013 DEVELOPMENT 第7章节--打包并部署SP2013 Apps 打包并公布App

    BEGINNING SHAREPOINT® 2013 DEVELOPMENT 第7章节--打包并部署SP2013 Apps 打包并公布App         如今既然你理解了一个app的四个主要部分, ...

  3. eclipse git 一个错误:the current branch is not configured for pull No value for key branch.xxx.merge found

    eclipse git 一个错误:the current branch is not configured for pull No value for key branch.xxx.merge fou ...

  4. SpringMVC+Mybatis(SMM)+mybatis-generate

    java搭建 SpringMVC+Mybatis(SMM)+mybatis-generate 搭建SSM系统,首先要了解整个过程: 1.创建spring-mvc项目 2.在maven中添加要引用的ja ...

  5. GitLab 之 Linux十分钟快装(转)

    先把 Shell 命令贴出来,楼主以 CentOS release 6.5 (Final) 64位 为例: //配置系统防火墙,把HTTP和SSH端口开放. sudo yum install curl ...

  6. Net中的反应式编程

    Net中的反应式编程(Reactive Programming)   系列主题:基于消息的软件架构模型演变 一.反应式编程(Reactive Programming) 1.什么是反应式编程:反应式编程 ...

  7. CodeForces 69D Dot (游戏+记忆)

    Description Anton and Dasha like to play different games during breaks on checkered paper. By the 11 ...

  8. CSDN上看到的一篇有关Spring JDBC事务管理的文章(内容比较全) (转)

    JDBC事务管理 Spring提供编程式的事务管理(Programmatic transaction manage- ment)与声明式的事务管理(Declarative transaction ma ...

  9. UVa10986_Sending email(最短)(白皮书图论的话题)

    解决报告 思路: 裸裸的最短路. #include <iostream> #include <cstring> #include <cstdio> #include ...

  10. 简单vector达到

    得知c++于,看完这本书后,,最近苦于不知道下一步该怎么做了,在寻找STL在各种容器的源代码分析,我想一次又一次地实现它. 之前,很多问题看的时候不知道是怎么回事,意与理解的.这个vector类写得特 ...