Unit1.cpp
上传用户:lhxd_sz
上传日期:2014-10-02
资源大小:38814k
文件大小:2k
- //---------------------------------------------------------------------------
- #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::ComboBox1Change(TObject *Sender)
- {
- int ii,st;
- AnsiString ss;
- ComboBox1->DroppedDown=True;
- ss=ComboBox1->Text.Trim();
- st=ComboBox1->SelStart;
- ii=SendMessage(ComboBox1->Handle,CB_FINDSTRING,0,long(ss.c_str()));
- if(ii!=CB_ERR)
- {
- ComboBox1->ItemIndex=ii;
- ComboBox1->Text=ss;
- ComboBox1->SelStart=st;
- }
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Edit1Change(TObject *Sender)
- {
- int ii,st;
- AnsiString ss;
- ss=Edit1->Text.Trim();
- ii=SendMessage(ListBox1->Handle,LB_FINDSTRING,0,long(ss.c_str()));
- if(ii!=LB_ERR)
- ListBox1->ItemIndex=ii;
- }
- //---------------------------------------------------------------------------
- void __fastcall TForm1::Edit2Change(TObject *Sender)
- {
- int ii,ll;
- AnsiString ss,ss1;
- ss=Edit2->Text.Trim();
- ll=ss.Length();
- for(ii=0;ii<ListBox1->Items->Count;ii++)
- {
- ss1=ListBox1->Items->Strings[ii];
- ss1=ss1.SubString(1,ll);
- if(ss1==ss)
- {
- ListBox1->ItemIndex=ii;
- break;
- }
- }
- }
- //---------------------------------------------------------------------------