C # The "lawn lamp" in C # is similar to the "Hamster" applet.

Source: Internet
Author: User

C # The "lawn lamp" in C # is similar to the "Hamster" applet.
Today, I reviewed the form applets I learned yesterday. It mainly applies to some basic attributes of controls. Program) * The first step is to set the interface (txtname, txtpwd. In the second text box, txtname sets its UseSystemPasswordChar attribute to true and MaxLength to 6) attribute of the text box: UseSystemPasswordChar indicates whether the text in the editing control is displayed with the default password character ("●. PasswordChar indicates that the displayed characters will be entered for the password of the single-line editing control. (You can enter any password characters you want to display, such *,?) MaxLength specifies the maximum number of characters that can be entered in the editing control Timer control attributes: mainly set the Enabled attribute to True; Interval (event frequency, in milliseconds) set it to 500. Here, it is mainly used to control the number of user logins. If it exceeds three times, the main code of Form1 form can be re-entered only after 500 milliseconds: <span style = "font-size: 16px;"> private void Form1_Activated (object sender, EventArgs e) {this.txt user. focus () ;}int I = 0; private void btnlogin_Click (object sender, EventArgs e) {string user = this.txt user. text. trim (); string pwd = this.txt pwd. text. trim (); If (I> = 3) {btnlogin. enabled = false;} if (string. isNullOrEmpty (user) {MessageBox. show ("incorrect user name, please enter again"); ++ I;} else if (string. isNullOrEmpty (pwd) {MessageBox. show ("the password cannot be blank. Please enter it again"); ++ I;} Form2 fm = new Form2 (user); <br> fm. show (); <br> this. hide (); // Hide the form <br >}} private void timerjavastick (object sender, EventArgs e) {btnlogin. enabled = true ;}</span> Form2 form interface, defines a Label control to receive the value (User Name) sent by Form1 here The Timer control is used to control the speed of string scrolling. Code: <span style = "font-size: 16px;"> string name = string. empty; public Form2 (string users) {InitializeComponent (); name = users + "Hello, welcome to china";} private void timereffectick (object sender, EventArgs e) {name = name. substring (1) + name. substring (0, 1); this. lblname. text = name;} private void btnclose_Click (object sender, EventArgs e) {this. close () ;}</span>

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.