C? #? ? Lee? Use? M? S? T? S? C? ? Association? Discussion? Real? Now? Solid? OK? Window? Port? ? Far? Cheng? Table? Surface

Source: Internet
Author: User
1 using system; 2 using system. collections. generic; 3 using system. componentmodel; 4 using system. data; 5 using system. drawing; 6 using system. text; 7 using system. windows. forms; 8 using system. io; 9 using system. XML; 10 11 namespace rdp_from 12 {13 public partial class form1: form 14 {15 /// <summary> 16 /// 17 /// </Summary> 18 private bool bquitack = false; 19 private point p_location = new point (0, 0); 20 private size f_size = new size (1200,102 4); 21 private string c_name = ""; 22 23 /// <summary> 24 // 25 /// </Summary> 26 Public form1 () 27 {28 initializecomponent (); 29 This. panel1.visible = false; 30 if (readsettions () 31 {32 this. location = p_location; 33 this. size = f_size; 34 this. formborderstyle = formborderstyle. none; 35} 36 else 37 {38 This. size = screen. primaryscreen. workingarea. size; 39} 40 this. rdp_client.size = This. size; 41 rdp_client.server = system. configuration. configurationmanager. appsettings ["c_server"]. tostring (); 42 rdp_client.username = system. configuration. configurationmanager. appsettings ["c_user_na"]. tostring (); 43 rdp_client.domain = system. configuration. configurationmanager. appsettings ["c_domain"]. tostring (); 44 rdp_client.advancedsettings2.cleartextpassword = system. configuration. configurationmanager. appsettings ["c_psw"]. tostring (); 45 46 rdp_client.connect (); 47} 48 49 private bool readsettions () 50 {51 try 52 {53 string filename = application. startuppath + "\ specialsettings. XML "; 54 xmldocument XD = new xmldocument (); 55 XD. load (filename); 56 57 xmlnode xns = XD. selectsinglenode ("/Settings"); 58 59 60 p_location.x = convert. toint32 (xns ["X"]. innertext); 61 p_location.y = convert. toint32 (xns ["Y"]. innertext); 62 f_size.width = convert. toint32 (xns ["width"]. innertext); 63 f_size.height = convert. toint32 (xns ["height"]. innertext); 64 c_name = xns ["name"]. innertext; 65 return true; 66} 67 catch (exception e) 68 {69 return false; 70} 71 72} 73 74 private void form=formclosing (Object sender, formclosingeventargs E) 75 {76 this. panel1.visible = true; 77 If (bquitack = false) 78 E. cancel = true; 79} 80 81 private void but_yes_click (Object sender, eventargs e) 82 {83 bquitack = true; 84 This. close (); 85} 86 87 private void but_cancel_click (Object sender, eventargs e) 88 {89 bquitack = false; 90 this. panel1.visible = false; 91 this. rdp_client. focus (); 92} 93 94 95 96 private void exit toolstripmenuitem1_click (Object sender, eventargs e) 97 {98 This. close (); 99} 100 101 private void reconnect toolstripmenuitem_click (Object sender, eventargs e) 102 {103 If (rdp_client.connected = 1) return; 104 rdp_client.connect (); 105} 106 107 private void form1_resize (Object sender, eventargs e) 108 {109} 110 111} 112}

 

C? #? ? Lee? Use? M? S? T? S? C? ? Association? Discussion? Real? Now? Solid? OK? Window? Port? ? Far? Cheng? Table? Surface

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.