时间: 2021-07-31 作者:daque
即使能精巧地应用数组会给咱们带来很多简单;以次是我的少许用法,还感触本人每控制它的精华;蓄意大师多多引导;(现丑了)void ) __declspec(dllexport) mylist::readlist(ansistring ts){//读出ini文献的数据 system::ansistring labpath=extractfilepath(".\\"); tinifile *labini=new tinifile(labpath+"labini.ini"); form2->addlist(); for(int i=0;i<form2->labellist->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;i<form2->labellist->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); }} system::ansistring labpath=extractfilepath(".\\"); tinifile *labini=new tinifile(labpath+"labini.ini"); tlist *labellist; labellist=new tlist; labellist->add(label1); labellist->add(label2); labellist->add(label3); labellist->add(label4); labellist->add(label5); labellist->add(label6); labellist->add(label7); labellist->add(label8); labellist->add(label9); labellist->add(label10); labellist->add(label11); labellist->add(label12); labellist->add(label13); labellist->add(label14); labellist->add(label15);void mylist::nmychick(tmenuitem *item,ansistring str,int bl){ file://记载tmenuitem 的状况: static tmenuitem *sitem=0; file://item=form2->popupmenu1->items; file://item=dynamic_cast<tmenuitem *>(form2->windowmenu->items->getparentmenu); if(sitem==item){ item->checked=false; return; } else if(sitem) sitem->checked=false; item->checked=true; sitem=item; if(item->checked==true){ file://¶¯ì¬¸ä±äform2µä´óð¡ºíðî×´ if(bl){ form2->image1->picture->bitmap->height =500; form2->image1->picture->bitmap->width =732; form2->image1->stretch = false; file://form2->image2->picture->loadfromfile(".\\logo.bmp"); form2->image2->width = form2->image2->picture->width; form2->image2->height = form2->image2->picture->height; form2->image2->top = 12; form2->image2->left = 15; form2->height = 500; form2->width = 732; form2->top = 0; form2->left = screen->width-form2->width; tcanvas *tss =form2->image1->picture->bitmap->canvas; form1->drawbarcode(tss,120,300,125); form2->update(); } else { form2->image1->picture->bitmap->height =732; form2->image1->picture->bitmap->width =555; form2->image1->stretch = false; form2->image2->width = form2->image2->picture->width; form2->image2->height = form2->image2->picture->height; form2->image2->top = 12; form2->image2->left = 15; form2->height =732 ; form2->width = 555; form2->top = 0; form2->left = screen->width-form2->width; form1->makelabel(); } form2->caption = string(form2->image1->picture->bitmap->height)+" - "+ string(form2->image1->picture->bitmap->width); readlist(str); form2->update(); }}void __fastcall tform2::formhide(tobject *sender){ ansistring bj[]={"打横1","打竖1","打横2","打竖2","打横3","打竖3","恢复原此树立"}; for(int i=0;i<popupmenu1->items->count;i++){ if(popupmenu1->items->items[i]->checked) lt->writelist(bj[i]); }}void __fastcall tform2::n4click(tobject *sender){ lt->nmychick(form2->n4,"打竖2",0);}void __fastcall tform2::n5click(tobject *sender){ lt->nmychick(form2->n5,"打横2",1);}void __fastcall tform2::n31click(tobject *sender){ lt->nmychick(form2->n31,"打竖3",0);}void __fastcall tform2::n32click(tobject *sender){ lt->nmychick(form2->n32,"打横3",1);}