|
論壇說明 |
歡迎您來到『史萊姆論壇』 ^___^ 您目前正以訪客的身份瀏覽本論壇,訪客所擁有的權限將受到限制,您可以瀏覽本論壇大部份的版區與文章,但您將無法參與任何討論或是使用私人訊息與其他會員交流。若您希望擁有完整的使用權限,請註冊成為我們的一份子,註冊的程序十分簡單、快速,而且最重要的是--註冊是完全免費的! 請點擊這裡:『註冊成為我們的一份子!』 |
|
主題工具 | 顯示模式 |
2005-09-05, 04:33 PM | #1 |
版區管理員
|
[C++ Builder]"自製"記事本
表單很大喔(因為有圖示)
語法:
object Form1: TForm1 Left = 192 Top = 114 Width = 824 Height = 613 Caption = '自製記事本' Color = clBtnFace DefaultMonitor = dmMainForm Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] OldCreateOrder = False PixelsPerInch = 96 TextHeight = 13 object Splitter1: TSplitter Left = 661 Top = 26 Width = 3 Height = 511 Cursor = crHSplit Align = alRight end object ToolBar1: TToolBar Left = 0 Top = 0 Width = 816 Height = 26 AutoSize = True Caption = 'ToolBar1' Images = ImageList1 TabOrder = 0 object ToolButton1: TToolButton Left = 0 Top = 2 Caption = 'ToolButton1' ImageIndex = 0 OnClick = ToolButton1Click end object ToolButton2: TToolButton Left = 23 Top = 2 Caption = 'ToolButton2' ImageIndex = 1 OnClick = ToolButton2Click end object ToolButton3: TToolButton Left = 46 Top = 2 Caption = 'ToolButton3' ImageIndex = 2 OnClick = ToolButton3Click end object ToolButton13: TToolButton Left = 69 Top = 2 Width = 8 Caption = 'ToolButton13' ImageIndex = 3 Style = tbsSeparator end object ToolButton14: TToolButton Left = 77 Top = 2 Caption = 'ToolButton14' ImageIndex = 3 OnClick = ToolButton14Click end object ToolButton15: TToolButton Left = 100 Top = 2 Caption = 'ToolButton15' ImageIndex = 4 OnClick = ToolButton15Click end object ToolButton16: TToolButton Left = 123 Top = 2 Caption = 'ToolButton16' ImageIndex = 5 OnClick = ToolButton16Click end end object StatusBar1: TStatusBar Left = 0 Top = 560 Width = 816 Height = 19 Panels = <> SimplePanel = False end object Memo1: TMemo Left = 0 Top = 26 Width = 661 Height = 511 Align = alClient Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Fixedsys' Font.Style = [] ParentFont = False ScrollBars = ssBoth TabOrder = 2 end object ToolBar2: TToolBar Left = 0 Top = 537 Width = 816 Height = 23 Align = alBottom AutoSize = True ButtonHeight = 21 ButtonWidth = 19 Caption = 'ToolBar2' DragKind = dkDock DragMode = dmAutomatic Flat = True ShowCaptions = True TabOrder = 3 object ToolButton4: TToolButton Left = 0 Top = 0 Caption = ',' ImageIndex = 0 OnClick = ToolButton4Click end object ToolButton5: TToolButton Left = 19 Top = 0 Caption = '。' ImageIndex = 1 OnClick = ToolButton5Click end object ToolButton6: TToolButton Left = 38 Top = 0 Caption = '、' ImageIndex = 2 OnClick = ToolButton6Click end object ToolButton7: TToolButton Left = 57 Top = 0 Caption = ';' ImageIndex = 3 OnClick = ToolButton7Click end object ToolButton8: TToolButton Left = 76 Top = 0 Caption = ':' ImageIndex = 4 OnClick = ToolButton8Click end object ToolButton9: TToolButton Left = 95 Top = 0 Caption = '!' ImageIndex = 5 OnClick = ToolButton9Click end object ToolButton10: TToolButton Left = 114 Top = 0 Caption = '?' ImageIndex = 6 OnClick = ToolButton10Click end object ToolButton11: TToolButton Left = 133 Top = 0 Caption = '「' ImageIndex = 7 OnClick = ToolButton11Click end object ToolButton12: TToolButton Left = 152 Top = 0 Caption = '『' ImageIndex = 8 OnClick = ToolButton12Click end end object Panel1: TPanel Left = 664 Top = 26 Width = 152 Height = 511 Align = alRight BevelOuter = bvLowered Caption = 'Panel1' TabOrder = 4 object ListBox1: TListBox Left = 1 Top = 27 Width = 150 Height = 483 Align = alClient Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Fixedsys' Font.Style = [] ItemHeight = 16 ParentFont = False TabOrder = 0 OnDblClick = ListBox1DblClick end object ToolBar3: TToolBar Left = 1 Top = 1 Width = 150 Height = 26 AutoSize = True Caption = 'ToolBar3' Images = ImageList2 TabOrder = 1 object ToolButton17: TToolButton Left = 0 Top = 2 Caption = 'ToolButton17' ImageIndex = 0 OnClick = ToolButton17Click end object ToolButton18: TToolButton Left = 23 Top = 2 Caption = 'ToolButton18' ImageIndex = 1 OnClick = ToolButton18Click end end end |
__________________ 『唸金母心咒:嗡。金母。悉地。吽。』 持此咒者,可免一切瘟疫,一切瘟神抱頭四散。 魔術就是欣賞神奇的效果 如果魔術的秘密被破解了 那魔術就失去欣賞的價值 |
|
送花文章: 1536,
|
2005-09-05, 04:37 PM | #2 (permalink) |
版區管理員
|
由於圖是實在太大所以只好省略
請自行加入2個TImageList元件ImageList1,ImageList2 ImageList1放6個圖示(圖示分別為"新檔""開啟""儲存""剪下""複製""貼上") ImageList2放2個圖示(圖示分別為"加入""移除") 語法:
object ImageList1: TImageList Left = 64 Top = 144 Bitmap = { 略(圖示分別為"新檔""開啟""儲存""剪下""複製""貼上") } end object OpenDialog1: TOpenDialog Left = 64 Top = 176 end object SaveDialog1: TSaveDialog Left = 64 Top = 208 end object ImageList2: TImageList Left = 96 Top = 144 Bitmap = { 略(圖示分別為"加入""移除") } end end |
送花文章: 1536,
|
2005-09-05, 04:44 PM | #3 (permalink) |
版區管理員
|
程式碼
語法:
//--------------------------------------------------------------------------- #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(); } //--------------------------------------------------------------------------- |
送花文章: 1536,
|
2005-09-15, 11:00 AM | #7 (permalink) |
版區管理員
|
http://homepage3.seed.net.tw/web@1/a_quan/MyEditor.rar
已經修改完了(還不是很滿意啦^^a) |
送花文章: 1536,
|
2005-09-16, 01:11 PM | #8 (permalink) |
註冊會員
|
建議把TRichedit換成TCppWebBrowser會比較好用,
有疑問請上 http://delphi.ktop.com.tw |
送花文章: 0,
|