学习CB (2)

定义保存窗体:

TSaveDialog *SaveDialog1 = new TSaveDialog(this);
SaveDialog1->Title="保存";
SaveDialog1->FileName=DateToStr(Date())+"EXPORT_CAD.dxf";
SaveDialog1->Filter="AutoCAD DXF(*.dxf)|*.dxf";
if(SaveDialog1->Execute())
{
  AnsiString temp= SaveDialog1->FileName;
  int createI = FileCreate(temp);
  FileClose(createI);
}
delete SaveDialog1;

 

使用TStringList

TStringList* strlist = new TStringList;
strlist->Add("tt");
strlist->Add("tt2");
strlist->Add("tt3");
//strlist->Sort();
int index=0;
strlist->Find("tt3",index);
ShowMessage(index);

delete strlist;

 

 

截取字符串

 int firstBlocks   =   tempBlocks.Pos("BLOCKS");
 int firstENTITIES =   tempBlocks.Pos("ENTITIES");
 tempBlocks = tempBlocks.SubString(firstBlocks,firstENTITIES-firstBlocks);

 

xml操作

 _di_IXMLDocument XMLDoctt =NewXMLDocument();
 XMLDoctt->Active = false;
 XMLDoctt->LoadFromXML(strXml);
 XMLDoctt->Active = true;
 IXMLNode* nodeRoot =   XMLDoctt->DocumentElement;

 AnsiString titleTxt = nodeRoot->GetAttribute(L"title");
 AnsiString noTxt = nodeRoot->GetAttribute(L"no");

 nodeRoot =   nodeRoot->ChildNodes->FindNode("line");
if(nodeRoot!=NULL){
    for (int i=0;i<nodeRoot->ChildNodes->Count;i++)
    {
      IXMLNode* childnode= nodeRoot->ChildNodes->GetNode(i);
      begx= childnode->GetAttribute(L"begx");
      endx= childnode->GetAttribute(L"endx");

       ......

    }

  }

..............

 

你可能感兴趣的:(学习CB (2))