C # window switch,

Source: Internet
Author: User

C # window switch,

Recently, I have been studying TCP/UDP and the thread, which is difficult. But if I don't try to meet them, can I solve the problem myself? Since we have to keep working on everything, please come on!

 

Today, let's record all the window switching problems I have found ~

1. The first method is relatively simple and cute, Which I accidentally discovered recently ~

1 public MainFrom_Client () 2 {3 InitializeComponent (); 4 SetMainTreadState (); 5} 6 7 // first set the main form (that is, MainFrom_Client) the transparency and taskbar status 8 private void SetMainTreadState () 9 {10 // This is actually a blind eye! Make the main form (that is, MainFrom_Client) invisible. 11 // you only need to change Opacity to 100. opacity = 0; 13 // then, hide the running display on the menu bar. 14 this. showInTaskbar = false; 15} 16 17 private void ResetMainThreadState () 18 {19 this. opacity = 100; 20 this. showInTaskbar = true; 21 // bring the current control to the front. 22 this. bringToFront (); 23}

In this case, the form is invisible. You can reset a function and call the ResetMainThreadState () function when a specific condition is met. The main form MainFrom_Client will be displayed ~
Mengmengda's method of hiding ears and alarms ~

 

2. Another problem is the real-time form calling (I have been searching for a long time and I am exhausted by T ^ T)

In the my Program. cs file, first determine the Login_interface () that appears first ().

1         static void Main()2         {3             Application.EnableVisualStyles();4             Application.SetCompatibleTextRenderingDefault(false);5             Login_interface login_1 = new Login_interface();6             login_1.Show();7             Application.Run();8         }

General Program. all files in cs are Application. run (new Login_interface, in this way, I cannot access the user interface. If I have to access the user interface, I can use a method similar to 1 and hide the user interface without displaying the logon interface.
This method is actually good, but I am a little dead, so I must close the logon interface, so in Program. application is set in cs. run (); in this way, the subsequent "Abuse" Logon interface will not affect the continued use of the program.

Then there is the program on my logon interface ~ It's easy ~

1 # region from the login interface to the user interface 2 private void button#click (object sender, EventArgs e) 3 {4 5 if (textBox_UserName.Text = "1" & textBox_PassWord.Text = "1") 6 {7 this. close (); 8 User_Panel fm = new User_Panel (); 9 fm. show (); 10} 11 else12 {13 MessageBox. show ("Incorrect username and password, please enter again"); 14} 15} 16 # endregion

 

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.