線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1670
推到 Plurk!
推到 Facebook!

C# 繁簡轉換程式

 
qoo1234
版主


發表:256
回覆:1167
積分:659
註冊:2003-02-24

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-08-15 12:56:48 IP:220.131.xxx.xxx 未訂閱
1.下載Hokoy.WordKit.dll檔,並註冊,才能執行本程式:
http://www.hokoy.com/Works/Program/HokoyWordKit.aspx

2.程式碼如下:    /*
 * 由 SharpDevelop .NET 免費開發工具 建立的 C# .NET 程式.
 * 作    者: 
 * 建立日期: 
 * 建立時間: 
 * 功    能: C# 繁簡轉換 COM 元件 之使用
 * 修改日期: 
 */
using System;
using System.Windows.Forms;
using Hokoy; 
namespace DefaultNamespace
{
 /// 
 /// Description of MainForm. 
 /// 
 public class MainForm : System.Windows.Forms.Form
 {
  private System.Windows.Forms.Label label2;
  private System.Windows.Forms.Button button1;
  private System.Windows.Forms.RichTextBox richTextBox1;
  private System.Windows.Forms.RichTextBox richTextBox2;
  private System.Windows.Forms.Button button2;
  private System.Windows.Forms.Label label1;
  public MainForm()
  {
   //
   // The InitializeComponent() call is required for Windows Forms designer support.
   //
   InitializeComponent();
   
   //
   // TODO: Add constructor code after the InitializeComponent() call.
   //
  }
  
  [STAThread]
  public static void Main(string[] args)
  {
   Application.Run(new MainForm());
  }
  
  #region Windows Forms Designer generated code
  /// 
  /// This method is required for Windows Forms designer support.
  /// Do not change the method contents inside the source code editor. The Forms designer might
  /// not be able to load this method if it was changed manually.
  /// 
  private void InitializeComponent() {
   this.label1 = new System.Windows.Forms.Label();
   this.button2 = new System.Windows.Forms.Button();
   this.richTextBox2 = new System.Windows.Forms.RichTextBox();
   this.richTextBox1 = new System.Windows.Forms.RichTextBox();
   this.button1 = new System.Windows.Forms.Button();
   this.label2 = new System.Windows.Forms.Label();
   this.SuspendLayout();
   // 
   // label1
   // 
   this.label1.Location = new System.Drawing.Point(8, 5);
   this.label1.Name = "label1";
   this.label1.Size = new System.Drawing.Size(64, 16);
   this.label1.TabIndex = 3;
   this.label1.Text = "來源:";
   // 
   // button2
   // 
   this.button2.Location = new System.Drawing.Point(464, 56);
   this.button2.Name = "button2";
   this.button2.Size = new System.Drawing.Size(80, 24);
   this.button2.TabIndex = 5;
   this.button2.Text = "簡體->繁體";
   this.button2.Click += new System.EventHandler(this.Button2Click);
   // 
   // richTextBox2
   // 
   this.richTextBox2.Location = new System.Drawing.Point(8, 176);
   this.richTextBox2.Name = "richTextBox2";
   this.richTextBox2.Size = new System.Drawing.Size(448, 128);
   this.richTextBox2.TabIndex = 2;
   this.richTextBox2.Text = "";
   // 
   // richTextBox1
   // 
   this.richTextBox1.Location = new System.Drawing.Point(8, 24);
   this.richTextBox1.Name = "richTextBox1";
   this.richTextBox1.Size = new System.Drawing.Size(448, 128);
   this.richTextBox1.TabIndex = 0;
   this.richTextBox1.Text = "";
   // 
   // button1
   // 
   this.button1.Location = new System.Drawing.Point(464, 24);
   this.button1.Name = "button1";
   this.button1.Size = new System.Drawing.Size(80, 24);
   this.button1.TabIndex = 1;
   this.button1.Text = "繁體->簡體";
   this.button1.Click += new System.EventHandler(this.Button1Click);
   // 
   // label2
   // 
   this.label2.Location = new System.Drawing.Point(8, 159);
   this.label2.Name = "label2";
   this.label2.Size = new System.Drawing.Size(80, 16);
   this.label2.TabIndex = 4;
   this.label2.Text = "轉換結果:";
   // 
   // MainForm
   // 
   this.AutoScaleBaseSize = new System.Drawing.Size(5, 15);
   this.ClientSize = new System.Drawing.Size(552, 318);
   this.Controls.Add(this.button2);
   this.Controls.Add(this.label2);
   this.Controls.Add(this.label1);
   this.Controls.Add(this.richTextBox2);
   this.Controls.Add(this.button1);
   this.Controls.Add(this.richTextBox1);
   this.Name = "MainForm";
   this.Text = "MainForm";
   this.ResumeLayout(false);
  }
  #endregion
  //繁體轉簡體
   void Button1Click(object sender, System.EventArgs e)
  {
   WordKitClass source1=new WordKitClass();
   Object OK1=new Object();
   if (richTextBox1.Text.Length>0)
   {
    OK1=source1.Big5toGB(richTextBox1.Text);
    richTextBox2.Text =OK1.ToString();
   }
  }
  //簡體轉繁體
  void Button2Click(object sender, System.EventArgs e)
  {
   WordKitClass source2=new WordKitClass();
   Object OK2=new Object();
   if (richTextBox1.Text.Length>0)
   {
    OK2=source2.GBtoBig5(richTextBox1.Text);
    richTextBox2.Text =OK2.ToString(); 
   }
  }
  
 }
}     
網海無涯,唯學是岸! 發表人 - qoo1234 於 2004/08/15 16:04:11
附加檔案:54800_gb2big.zip
cmf
尊榮會員


發表:84
回覆:918
積分:1032
註冊:2002-06-26

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-08-16 11:33:05 IP:61.218.xxx.xxx 未訂閱
hot hot hot hot hot hot hot hot hot hot COOL!COOL!COOL!COOL!COOL!COOL!COOL!COOL! 贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊! 贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊! 贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊! 贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊! 贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊! 贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!贊!
每天省下一包菸的錢 愛心1000元餵飽一名非洲飢餓兒童 http://www.worldvision.org.tw/edm/30hffan/30hf1000.htm
------
︿︿
系統時間:2024-07-04 2:05:50
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!