ITPub博客

TList,AnsiString和DynamicArray的妙用 (转)

原创 IT综合 作者:amyz 时间:2008-03-22 16:59:40 0 删除 编辑
TList,AnsiString和DynamicArray的妙用 (转)[@more@]

  System::AnsiString LabPath=ExtractFilePath(".");
  TIniFile *LabIni=new TIniFile(LabPath+"LabIni.ini");

void myList::ReadList(AnsiString TS)
{
  System::AnsiString LabPath=ExtractFilePath(".");
  TIniFile *LabIni=new TIniFile(LabPath+"LabIni.ini");

  Form2->AddList();
  for(int i=0;iLabelList->Count;i++)
  {
  TLabel *Lab;
  Lab=(TLabel *)Form2->LabelList->Items[i];
  Lab->Left=LabIni->ReadInteger(TS,"Left"+IntToStr(i), Lab->Left);
  Lab->Top=LabIni->ReadInteger(TS,"Top"+IntToStr(i),Lab->Top);
  }
}

//----------------------------------------------------------------------------
void myList::WriteList(AnsiString TS)
{
  System::AnsiString LabPath=ExtractFilePath(".");
  TIniFile *LabIni=new TIniFile(LabPath+"LabIni.ini");
  Form2->AddList();
  for(int i=0;iLabelList->Count;i++)
  {
  TLabel *Lab;
  Lab=(TLabel *)Form2->LabelList->Items[i];
  LabIni->WriteInteger(TS,"Left"+IntToStr(i), Lab->Left);
  LabIni->WriteInteger(TS,"Top"+IntToStr(i),Lab->Top);
  }
}

file://----------------------------------------------------------------------------------------------------

struct mySEL {
  AnsiString PRUNO;
  int TOT_STK;//总进货
  int STK_PIN;//进货件数
  int STK_PBK;//退货件数
  int STK_PCS;//库存件数
  int STK_SAL;//销售件数
  int STK_PNT;//进货订货件数
  int STK_PONT;//销售订货件数
};
DynamicArraymySELArraymySELArray.Length=Query->RecordCount;
for(Query->First();!Query->Eof;Query->Next())
  {
  if(T){
  mySELArray[i].STK_SAL=Query->FieldbyName("SAL")->AsInteger;
  mySELArray[i].STK_PCS=Query->FieldByName("PCS")->AsInteger;
  mySELArray[i].PRUNO=Query->FieldByName("PRUNO")->AsString;
  }
  else
  {mySELArray[i].STK_PONT=Query->FieldByName("PNT")->AsInteger;
  mySELArray[i].PRUNO=Query->FieldByName("PRUNO")->AsString;
  }
  }


请登录后发表评论 登录
全部评论
  • 博文量
    3994
  • 访问量
    7256419