Курсовая работа: Работа со списками
void __fastcall TfrmMain::ListBox1KeyDown(TObject *Sender, WORD &Key,
TShiftState Shift)
{
if (Key==46){
int object=WhichObject(ListBox1->ItemIndex+1);
frmMain->lblPicture->Refresh();
int z=ListBox1->ItemIndex;
LineBufer.remove(ListBox1->ItemIndex+1);ListBox1->Items->Delete(ListBox1->ItemIndex);
ListBox1->ItemIndex=z;
Objects.change(object,Objects.getvalue(object)-1);
if (Objects.getvalue(object)==0) {Objects.remove(object);lstObjects->Items->Delete(object-1);}
LoadLines(chkSecondary->Checked);
}//end if
}
//---------------------------------------------------------------------------
void __fastcall TfrmMain::lstObjectsClick(TObject *Sender)
{
int begin=0;
for (int i=0;i<lstObjects->ItemIndex;i++)begin+=Objects.getvalue(i);
ListBox1->ItemIndex=begin;
}
//---------------------------------------------------------------------------
void __fastcall TfrmMain::lblPictureMouseMove(TObject *Sender,
TShiftState Shift, int X, int Y)
{
lblCoords->Caption=IntToStr(X)+"; "+IntToStr(Y);
}
//---------------------------------------------------------------------------