?? unit1.cpp
字號(hào):
//---------------------------------------------------------------------------
#include <vcl.h>
#pragma hdrstop
#include "Unit1.h"
//---------------------------------------------------------------------------
#pragma package(smart_init)
#pragma link "CSPIN"
#pragma resource "*.dfm"
TForm1 *Form1;
//---------------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormShow(TObject *Sender)
{
this->RadioGroup1->Items->LoadFromFile("items.txt");
Index=-1;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::RadioGroup1Click(TObject *Sender)
{
// this->RadioGroup1->Items->Strings
if(Index>=0) this->ListBox1->Items->SaveToFile(this->RadioGroup1->Items->Strings[Index]+".txt");
if (FileExists(this->RadioGroup1->Items->Strings[this->RadioGroup1->ItemIndex]+".txt"))
{
this->ListBox1->Items->LoadFromFile(this->RadioGroup1->Items->Strings[this->RadioGroup1->ItemIndex]+".txt");
}else this->ListBox1->Items->Clear();
Index=this->RadioGroup1->ItemIndex;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ListBox1Click(TObject *Sender)
{
this->Memo1->Lines->Clear();
this->Memo1->Lines->Add(this->ListBox1->Items->Strings[this->ListBox1->ItemIndex]);
this->Memo1->SelectAll();
this->Memo1->CopyToClipboard();
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Edit1KeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
if(Key==13)
{
if(RadioGroup2->ItemIndex==0){
RadioGroup1->Items->Add(Edit1->Text);
RadioGroup1->Items->SaveToFile("items.txt");
};
if(RadioGroup2->ItemIndex==1){
ListBox1->Items->Add(Edit1->Text);
// ListBox1->Items->SaveToFile(this->RadioGroup1->Items->Strings[this->RadioGroup1->ItemIndex]+".txt");
};
Edit1->Text="";
};
}
//---------------------------------------------------------------------------
void __fastcall TForm1::Button1Click(TObject *Sender)
{
if(RadioGroup2->ItemIndex==0){
RadioGroup1->Items->Add(Edit1->Text);
RadioGroup1->Items->SaveToFile("items.txt");
};
if(RadioGroup2->ItemIndex==1){
ListBox1->Items->Add(Edit1->Text);
// ListBox1->Items->SaveToFile(this->RadioGroup1->Items->Strings[this->RadioGroup1->ItemIndex]+".txt");
};
Edit1->Text="";
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ListBox1DblClick(TObject *Sender)
{ this->ListBox1->Items->Delete(this->ListBox1->ItemIndex);
}
//---------------------------------------------------------------------------
void __fastcall TForm1::N1Click(TObject *Sender)
{
if(OpenDialog1->Execute())
{
this->ListBox2->Items->LoadFromFile(OpenDialog1->FileName);
};
}
//---------------------------------------------------------------------------
void __fastcall TForm1::N4Click(TObject *Sender)
{
this->N4->Checked=!this->N4->Checked;
this->N1->Enabled=this->N4->Checked;
this->ListBox1->Visible=!this->N4->Checked;
this->ListBox2->Visible=this->N4->Checked;
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ListBox2MouseUp(TObject *Sender,
TMouseButton Button, TShiftState Shift, int X, int Y)
{
if(this->ListBox2->ItemIndex==-1) return;
if(Button==mbRight)
{
ListBox1->Items->Add(this->ListBox2->Items->Strings[this->ListBox2->ItemIndex]);
// ListBox1->Items->SaveToFile(this->RadioGroup1->Items->Strings[this->RadioGroup1->ItemIndex]+".txt");
this->ListBox2->Items->Delete(this->ListBox2->ItemIndex);
};
}
//---------------------------------------------------------------------------
void __fastcall TForm1::ListBox2DblClick(TObject *Sender)
{
this->ListBox1->Items->Delete(this->ListBox1->ItemIndex);
}
//---------------------------------------------------------------------------
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -