I'll just stick to an example to illustrate:
Copy Code code as follows:
Form1.cs
Using System;
Using System.Collections.Generic;
Using System.ComponentModel;
Using System.Data;
Using System.Drawing;
Using System.Text;
Using System.Windows.Forms;
Using Encodemy;
Namespace Testencode
{
public partial class Form1:form
{
Public Form1 ()
{
InitializeComponent ();
}
private void Button1_Click (object sender, EventArgs e)
{
Encoderobert Edcontrol = new Encoderobert ();//Create a simple Transform object
txtresult.text= Edcontrol.sctcconvert (converttype.simplified, converttype.traditional,txtsource.text);//For simple propagation
}
}
}
Note: Using Encodemy is not a. NET self-contained class library, in Encode.dll. To quote.
Please go to http://download.csdn.net/source/617532.
http://download.csdn.net/user/farawayplace613 Download the code for this instance, which does not require a resource to be divided. Encode.dll is in the Debug folder.
Copy Code code as follows:
Form1.Designer.cs
Namespace Testencode
{
Partial class Form1
{
<summary>
The required designer variable.
</summary>
Private System.ComponentModel.IContainer components = null;
<summary>
Clean up all resources that are in use.
</summary>
<param name= "disposing" > if the managed resource should be freed, true; otherwise, false. </param>
protected override void Dispose (bool disposing)
{
if (disposing && (components!= null))
{
Components. Dispose ();
}
Base. Dispose (disposing);
}
Code generated #region the Windows forms Designer
<summary>
Designer supports the required methods-No
Use the Code Editor to modify the contents of this method.
</summary>
private void InitializeComponent ()
{
This.txtsource = new System.Windows.Forms.TextBox ();
This.txtresult = new System.Windows.Forms.TextBox ();
This.button1 = new System.Windows.Forms.Button ();
This.label1 = new System.Windows.Forms.Label ();
This.label2 = new System.Windows.Forms.Label ();
This. SuspendLayout ();
//
Txtsource
//
This.txtSource.Location = new System.Drawing.Point (75, 26);
This.txtSource.Name = "Txtsource";
This.txtSource.Size = new System.Drawing.Size (100, 22);
This.txtSource.TabIndex = 0;
//
Txtresult
//
This.txtResult.Location = new System.Drawing.Point (75, 126);
This.txtResult.Name = "Txtresult";
This.txtResult.Size = new System.Drawing.Size (100, 22);
This.txtResult.TabIndex = 1;
//
Button1
//
This.button1.Location = new System.Drawing.Point (75, 78);
This.button1.Name = "Button1";
This.button1.Size = new System.Drawing.Size (75, 23);
This.button1.TabIndex = 2;
This.button1.Text = "Simple multiplication and transformation";
This.button1.UseVisualStyleBackColor = true;
This.button1.Click + = new System.EventHandler (This.button1_click);
//
Label1
//
This.label1.AutoSize = true;
This.label1.Location = new System.Drawing.Point (23, 29);
This.label1.Name = "Label1";
This.label1.Size = new System.Drawing.Size (41, 12);
This.label1.TabIndex = 3;
This.label1.Text = "convert source";
//
Label2
//
This.label2.AutoSize = true;
This.label2.Location = new System.Drawing.Point (12, 136);
This.label2.Name = "Label2";
This.label2.Size = new System.Drawing.Size (53, 12);
This.label2.TabIndex = 4;
This.label2.Text = "conversion result";
//
Form1
//
This. Autoscaledimensions = new System.Drawing.SizeF (6F, 12F);
This. AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
This. ClientSize = new System.Drawing.Size (320, 277);
This. Controls.Add (THIS.LABEL2);
This. Controls.Add (THIS.LABEL1);
This. Controls.Add (This.button1);
This. Controls.Add (This.txtresult);
This. Controls.Add (This.txtsource);
This. Name = "Form1";
This. Text = "Simple traditional conversion test";
This. ResumeLayout (FALSE);
This. PerformLayout ();
}
#endregion
Private System.Windows.Forms.TextBox Txtsource;
Private System.Windows.Forms.TextBox Txtresult;
Private System.Windows.Forms.Button button1;
Private System.Windows.Forms.Label Label1;
Private System.Windows.Forms.Label Label2;
}
}
Note that the download below downloads the project created by VS2008.
You may need to copy the code into your own environment. The important thing in the download is Encode.dll.
Haha, simple, just two sentences to fix the simple traditional conversion.
Author: Cheng
Original from: http://blog.csdn.net/farawayplace613/archive/2008/09/10/2910527.aspx