-
c语言入门之在BCB中数组的妙用和纪录和改变控件
如果能巧妙地运用数组会给我们带来很多方便;以下是我的一些用法,还觉得自己每掌握它的精髓;希望大家多多指点;(现丑了)
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);
}
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);
}
最新更新
nodejs爬虫
Python正则表达式完全指南
爬取豆瓣Top250图书数据
shp 地图文件批量添加字段
爬虫小试牛刀(爬取学校通知公告)
【python基础】函数-初识函数
【python基础】函数-返回值
HTTP请求:requests模块基础使用必知必会
Python初学者友好丨详解参数传递类型
如何有效管理爬虫流量?
2个场景实例讲解GaussDB(DWS)基表统计信息估
常用的 SQL Server 关键字及其含义
动手分析SQL Server中的事务中使用的锁
openGauss内核分析:SQL by pass & 经典执行
一招教你如何高效批量导入与更新数据
天天写SQL,这些神奇的特性你知道吗?
openGauss内核分析:执行计划生成
[IM002]Navicat ODBC驱动器管理器 未发现数据
初入Sql Server 之 存储过程的简单使用
SQL Server -- 解决存储过程传入参数作为s
JavaScript判断两个数组相等的四类方法
js如何操作video标签
React实战--利用甘特图和看板,强化Paas平
【记录】正则替换的偏方
前端下载 Blob 类型整理
抽象语法树AST必知必会
关于JS定时器的整理
JS中使用Promise.all控制所有的异步请求都完
js中字符串的方法
import-local执行流程与node模块路径解析流程