{"id":444,"date":"2010-10-01T02:30:06","date_gmt":"2010-10-01T02:30:06","guid":{"rendered":"http:\/\/enjoyasp.net\/?p=444"},"modified":"2010-10-01T02:30:06","modified_gmt":"2010-10-01T02:30:06","slug":"winform%e4%b8%adtextbox%e4%b8%ad%e7%9a%84%e6%8d%a2%e8%a1%8c","status":"publish","type":"post","link":"https:\/\/enjoyasp.net\/index.php\/2010\/10\/01\/winform%e4%b8%adtextbox%e4%b8%ad%e7%9a%84%e6%8d%a2%e8%a1%8c\/","title":{"rendered":"WinForm\u4e2dTextBox\u4e2d\u7684\u6362\u884c"},"content":{"rendered":"<p>\u7528\\n\u662f\u4e0d\u53ef\u4ee5\u7684\uff0c\u8981\u7528\\r\\n,\u4e3b\u8981\u662f\u56e0\u4e3aTextBox\u8fd0\u884c\u5728Windows\u4e0a\u3002Windows\u80fd\u591f\u663e\u793a\u7684\u6362\u884c\u5fc5\u987b\u7531\u4e24\u4e2a\u5b57\u7b26\u7ec4\u6210\uff1acarriage return &amp; line feed\uff0c\u4e5f\u5c31\u662f\u5fc5\u987b\u662f&#8221;\\r\\n&#8221;\u3002<br \/>\n\u4e3a\u4e86\u4fdd\u8bc1\u53ef\u8de8\u5e73\u53f0\uff0c\u6700\u597d\u7528\uff1a Environment.NewLine<\/p>\n<p>\u6ce8\uff1aConsole, WebForm\u7528 \/n\u662f\u6b63\u5e38\u7684<\/p>\n<p>Environment\u65b9\u6cd5\uff1a<\/p>\n<p>1.\u83b7\u53d6\u64cd\u4f5c\u7cfb\u7edf\u7248\u672c(PC,PDA\u5747\u652f\u6301)<br \/>\nEnvironment.OSVersion<\/p>\n<p>2.\u83b7\u53d6\u5e94\u7528\u7a0b\u5e8f\u5f53\u524d\u76ee\u5f55(PC\u652f\u6301)<br \/>\nEnvironment.CurrentDirectory<\/p>\n<p>3.\u5217\u4e3e\u672c\u5730\u786c\u76d8\u9a71\u52a8\u5668(PC\u652f\u6301)<br \/>\nstring [] strDrives=Environment.GetLogicalDrives();<br \/>\nforeach(string strDrive in strDrives)<br \/>\n{<br \/>\n?????<br \/>\n}<\/p>\n<p>4.\u83b7\u53d6.Net Framework\u7248\u672c\u53f7(PC,PDA\u5747\u652f\u6301)<br \/>\nEnvironment.Version<\/p>\n<p>5.\u83b7\u53d6\u673a\u5668\u540d(PC\u652f\u6301)<br \/>\nEnvironMent.MachineName<\/p>\n<p>6.\u83b7\u53d6\u5f53\u524d\u73af\u5883\u6362\u884c\u7b26(PC\u652f\u6301)<br \/>\nEnvironment.NewLine<\/p>\n<p>7.\u83b7\u53d6\u5904\u7406\u5668\u4e2a\u6570(PC\u652f\u6301)<br \/>\nEnvironment.SystemDirectory<\/p>\n<p>8.\u83b7\u53d6\u5f53\u524d\u767b\u5f55\u7528\u6237(PC\u652f\u6301)<br \/>\nEnvironment.UserName<\/p>\n<p>9.\u83b7\u53d6\u7cfb\u7edf\u4fdd\u7559\u6587\u4ef6\u5939\u8def\u5f84(PC,PDA\u5747\u652f\u6301)<br \/>\nEnvironment.GetFolderPath(Environment.SpecialFolder\u5bf9\u8c61)<br \/>\nEnvironment.SpecialFolder\u5bf9\u8c61\u63d0\u4f9b\u7cfb\u7edf\u4fdd\u7559\u6587\u4ef6\u5939\u6807\u8bc6\uff0c\u4f8b\u5982:Environment.SpecialFolder.Desktop\u8868\u793a\u684c\u9762\u6587\u4ef6\u5939\u7684\u8def\u5f84<\/p>\n<p>10.\u83b7\u53d6\u547d\u4ee4\u884c\u53c2\u6570(PC\u652f\u6301)<br \/>\nstring [] strParams=Environment.GetCommandLineArgs();<br \/>\nforeach(string strParam in strParams)<br \/>\n{<br \/>\n?????<br \/>\n}<\/p>\n<p>11.\u83b7\u53d6\u7cfb\u7edf\u73af\u5883\u53d8\u91cf(PC\u652f\u6301)<br \/>\nSystem.Collections.IDictionary dict=Environment.GetEnvironmentVariables();<br \/>\nstring str=dict[&#8220;Path&#8221;].ToString();<\/p>\n<p>12.\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf(PC\u652f\u6301)<br \/>\nEnvironment.SetEnvironmentVariable(&#8220;Path&#8221;, &#8220;Test&#8221;);<\/p>\n<p>13.\u83b7\u53d6\u57df\u540d(PC\u652f\u6301)<br \/>\nstring strUser = Environment.UserDomainName;<\/p>\n<p>14.\u83b7\u53d6\u622a\u81f3\u5230\u5f53\u524d\u65f6\u95f4\uff0c\u64cd\u4f5c\u7cfb\u7edf\u542f\u52a8\u7684\u6beb\u79d2\u6570(PDA,PC\u5747\u652f\u6301)<br \/>\nstr = Environment.TickCount.ToString();<\/p>\n<p>15.\u6620\u5c04\u5230\u5f53\u524d\u8fdb\u7a0b\u7684\u7269\u7406\u5185\u5b58\u6570<br \/>\nstr = Environment.WorkingSet.ToString();<\/p>\n<p>16.\u9000\u51fa\u5e94\u7528\u7a0b\u5e8f<br \/>\nEnvironment.Exit(0)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u7528\\n\u662f\u4e0d\u53ef\u4ee5\u7684\uff0c\u8981\u7528\\r\\n,\u4e3b\u8981\u662f\u56e0\u4e3aTextBox\u8fd0\u884c\u5728Windows\u4e0a\u3002Windows\u80fd\u591f\u663e\u793a\u7684\u6362\u884c\u5fc5 [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[35],"tags":[],"class_list":["post-444","post","type-post","status-publish","format-standard","hentry","category-aspdotnet"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/444","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/comments?post=444"}],"version-history":[{"count":0,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/posts\/444\/revisions"}],"wp:attachment":[{"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/media?parent=444"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/categories?post=444"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/enjoyasp.net\/index.php\/wp-json\/wp\/v2\/tags?post=444"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}