史萊姆論壇

返回   史萊姆論壇 > 專業主討論區 > 程式語言討論區
忘記密碼?
論壇說明

歡迎您來到『史萊姆論壇』 ^___^

您目前正以訪客的身份瀏覽本論壇,訪客所擁有的權限將受到限制,您可以瀏覽本論壇大部份的版區與文章,但您將無法參與任何討論或是使用私人訊息與其他會員交流。若您希望擁有完整的使用權限,請註冊成為我們的一份子,註冊的程序十分簡單、快速,而且最重要的是--註冊是完全免費的!

請點擊這裡:『註冊成為我們的一份子!』

Google 提供的廣告


 
 
主題工具 顯示模式
舊 2005-09-05, 04:44 PM   #3 (permalink)
版區管理員
 
魔術王子 的頭像
榮譽勳章
UID - 115097
在線等級: 級別:43 | 在線時長:2028小時 | 升級還需:84小時級別:43 | 在線時長:2028小時 | 升級還需:84小時級別:43 | 在線時長:2028小時 | 升級還需:84小時
註冊日期: 2004-01-13
住址: 魔術學園
文章: 3094
精華: 0
現金: 15408 金幣
資產: 2679048 金幣
預設

程式碼
語法:
//---------------------------------------------------------------------------

#include <vcl.h>
#pragma hdrstop

#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
  : TForm(Owner)
{
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ToolButton1Click(TObject *Sender)
{
  Memo1->Clear();   
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ToolButton2Click(TObject *Sender)
{
  if(OpenDialog1->Execute()) Memo1->Lines->LoadFromFile(OpenDialog1->FileName);
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ToolButton3Click(TObject *Sender)
{
  if(SaveDialog1->Execute()) Memo1->Lines->SaveToFile(SaveDialog1->FileName);
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ToolButton14Click(TObject *Sender)
{
  Memo1->CutToClipboard();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ToolButton15Click(TObject *Sender)
{
  Memo1->CopyToClipboard();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ToolButton16Click(TObject *Sender)
{
  Memo1->PasteFromClipboard();
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ToolButton4Click(TObject *Sender)
{
  int i=Memo1->SelStart+1;
  String s=Memo1->Text;
  s.Insert(",",i);
  Memo1->Text=s;
  Memo1->SelStart=i+1;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ToolButton5Click(TObject *Sender)
{
  int i=Memo1->SelStart+1;
  String s=Memo1->Text;
  s.Insert("。",i);
  Memo1->Text=s;
  Memo1->SelStart=i+1;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ToolButton6Click(TObject *Sender)
{
  int i=Memo1->SelStart+1;
  String s=Memo1->Text;
  s.Insert("、",i);
  Memo1->Text=s;
  Memo1->SelStart=i+1;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ToolButton7Click(TObject *Sender)
{
  int i=Memo1->SelStart+1;
  String s=Memo1->Text;
  s.Insert(";",i);
  Memo1->Text=s;
  Memo1->SelStart=i+1;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ToolButton8Click(TObject *Sender)
{
  int i=Memo1->SelStart+1;
  String s=Memo1->Text;
  s.Insert(":",i);
  Memo1->Text=s;
  Memo1->SelStart=i+1;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ToolButton9Click(TObject *Sender)
{
  int i=Memo1->SelStart+1;
  String s=Memo1->Text;
  s.Insert("!",i);
  Memo1->Text=s;
  Memo1->SelStart=i+1;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ToolButton10Click(TObject *Sender)
{
  int i=Memo1->SelStart+1;
  String s=Memo1->Text;
  s.Insert("?",i);
  Memo1->Text=s;
  Memo1->SelStart=i+1;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ToolButton11Click(TObject *Sender)
{
  int i=Memo1->SelStart+1;
  String s=Memo1->Text;
  s.Insert("「」",i);
  Memo1->Text=s;
  Memo1->SelStart=i+1;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ToolButton12Click(TObject *Sender)
{
  int i=Memo1->SelStart+1;
  String s=Memo1->Text;
  s.Insert("『』",i);
  Memo1->Text=s;
  Memo1->SelStart=i+1;
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ToolButton17Click(TObject *Sender)
{
  ListBox1->Items->Add(Memo1->SelText);  
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ToolButton18Click(TObject *Sender)
{
  if(ListBox1->ItemIndex>=0) ListBox1->Items->Delete(ListBox1->ItemIndex);
}
//---------------------------------------------------------------------------

void __fastcall TForm1::ListBox1DblClick(TObject *Sender)
{
  int i=Memo1->SelStart+1;
  String s=Memo1->Text;
  s.Insert(ListBox1->Items->Strings[ListBox1->ItemIndex],i);
  Memo1->Text=s;
  Memo1->SelStart=i+ListBox1->Items->Strings[ListBox1->ItemIndex].Length()-1;
  Memo1->SetFocus();
}
//---------------------------------------------------------------------------
魔術王子 目前離線  
送花文章: 1548, 收花文章: 1586 篇, 收花: 3941 次
回覆時引用此帖
 



發表規則
不可以發文
不可以回覆主題
不可以上傳附加檔案
不可以編輯您的文章

論壇啟用 BB 語法
論壇啟用 表情符號
論壇啟用 [IMG] 語法
論壇禁用 HTML 語法
Trackbacks are 禁用
Pingbacks are 禁用
Refbacks are 禁用


所有時間均為台北時間。現在的時間是 05:51 AM


Powered by vBulletin® 版本 3.6.8
版權所有 ©2000 - 2026, Jelsoft Enterprises Ltd.


SEO by vBSEO 3.6.1