List.cpp
上传用户:lulishicai
上传日期:2010-03-01
资源大小:13202k
文件大小:1k
源码类别:
Delphi/CppBuilder
开发平台:
C++ Builder
- //---------------------------------------------------------------------------
- #include <vcl.h>
- #pragma hdrstop
- #include "List.h"
- //---------------------------------------------------------------------------
- #pragma package(smart_init)
- #pragma resource "*.dfm"
- TForm1 *Form1;
- //---------------------------------------------------------------------------
- __fastcall TForm1::TForm1(TComponent* Owner)
- : TForm(Owner)
- {
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::FormCreate(TObject *Sender)
- {
- Form1->ComboBox1->Items=Screen->Fonts;
- Form1->ListBox1->Items=Screen->Fonts;
- //设置列表框控件的列表项
- Form1->Memo1->Lines->LoadFromFile("如果你是我的传说.txt");
- //设置文本框显示内容
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::ListBox1Click(TObject *Sender)
- {
- Memo1->Font->Name=ListBox1->Items->Strings[ListBox1->ItemIndex];
- //为Memo控件应用选中的字体
- ComboBox1->ItemIndex=ListBox1->ItemIndex;
- //显示相应的关联选项
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::ComboBox1Click(TObject *Sender)
- {
- ListBox1->ItemIndex=ComboBox1->ItemIndex;
- //显示相应的关联选项
- Memo1->Font->Name=ListBox1->Items->Strings[ListBox1->ItemIndex];
- //为Memo控件应用选中的字体
- }
- //---------------------------------------------------------------------------