1. Using system. runtime. interopservices;
2. Import kernel32.dllCopySave
[Dllimport ("Kernel32.dll", Entrypoint ="Lcmapstringa")]Public Static Extern IntLcmapstring (IntLocale,IntDwmapflags,Byte[] Lpsrcstr,IntCchsrc,Byte[] Lpdeststr,IntCchdest );Const IntLcmap_simplified_chinese.0 x 02000000;Const IntLcmap_traditional_chinese.0 x 04000000;
3. SimplifiedCopySave
Private VoidBtnchs_click (ObjectSender, eventargs e ){StringSrc = txtsrctext. Text. Trim ();Byte[] Srcbyte = encoding. Default. getbytes (SRC );Byte[] Desbyte =New Byte[Srcbyte. Length]; lcmapstring (2052, lcmap_simplified_chinese, srcbyte,-1, desbyte, srcbyte. Length );StringDes = encoding. Default. getstring (desbyte); txtdestext. Text = des ;}
4. Convert to traditional ChineseCopySave
Private VoidBtncht_click (ObjectSender, eventargs e ){StringSrc = txtsrctext. Text. Trim ();Byte[] Srcbyte = encoding. Default. getbytes (SRC );Byte[] Desbyte =New Byte[Srcbyte. Length]; lcmapstring (2052, lcmap_traditional_chinese, srcbyte,-1, desbyte, srcbyte. Length );StringDes = encoding. Default. getstring (desbyte); txtdestext. Text = des ;}
5. about the previous C # simplified and traditional conversion method (Microsoft. visualBasic. DLL) A friend mentioned the problem that "yu" cannot be converted to "yu". In this article, the method has not been resolved ,:-(. The younger brother finds n documents and other people's programs, and WebService does not solve the problem either, unless the font is used. However, in Office 2003, the simple and traditional conversion add-on can be solved. Currently, I am thinking about it from this perspective. If I have any answers, I will post them for discussion with my friends.