本文整理汇总了C++中AnsiString::printf方法的典型用法代码示例。如果您正苦于以下问题:C++ AnsiString::printf方法的具体用法?C++ AnsiString::printf怎么用?C++ AnsiString::printf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AnsiString
的用法示例。
在下文中一共展示了AnsiString::printf方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: PutBook
//---------------------------------------------------------------------------
//Процедура добавления книги выбранному предмету
void __fastcall TMainForm::PutBook(TObject *Sender){
BookForm->BitBtn2->Visible=true;
if(BookForm->ShowModal()==mrOk){
int bkod,sid,upkod,uid;
AnsiString sql;
bkod=Tree->Tag;
sid=(int)Tree->Selected->Data;
uid=Login->Tag;
//Проверяем это добавление новой книги или замена
switch(((TComponent *)Sender)->Tag){
case 0: sql.printf("insert into spisbook (id,kbook,iduser) values (%d,%d,%d)",sid,bkod,uid);
break;
case 1: upkod=DM->dsTree->FieldByName("KBOOK")->Value;
sql.printf("update spisbook set kbook=%d, iduser=%d where id=%d and kbook=%d",bkod,uid,sid,upkod);
}
DM->dsTree->First();
//Проверка если данная книга в выбранном разделе
while(!DM->dsTree->Eof){
if(DM->dsTree->FieldByName("KBOOK")->AsInteger==bkod){
Application->MessageBox("Эта книга здесь уже есть!", "Look", MB_OK);
return;
}
DM->dsTree->Next();
}
DM->qInsert->SQL->Clear();
DM->qInsert->SQL->Add(sql);
DM->qInsert->Prepare();
DM->qInsert->ExecQuery();
DM->dsTree->Close();
DM->dsTree->Open();
}
}
示例2: AdjustProperty
void TForm_Main::AdjustProperty(float fAmount)
{
if (!m_hSample)
return;
// Get the current value
float fValue = atof(c_Edit_Value->Text.c_str());
// Adjust
fValue += fAmount;
// Tell Miles
AIL_set_filter_sample_preference(m_hSample, c_ComboBox_Property->Text.c_str(), &fValue);
// Get it back out in case we hit a max/min
fValue = ReadProperty();
// Put it back in the edit
AnsiString holdString;
holdString.printf("%0.4f", fValue);
c_Edit_Value->Text = holdString;
// Update the property cache
int iCurProperty = 0;
RIB_INTERFACE_ENTRY ribAttrib;
HINTENUM enumerator(HINTENUM_FIRST);
while ((iCurProperty < m_iNumProperties) &&
AIL_enumerate_filter_sample_attributes(m_hCurFilter, &enumerator, &ribAttrib))
{
AIL_filter_sample_attribute(m_hSample, ribAttrib.entry_name, &m_fProperties[iCurProperty]);
++iCurProperty;
}
}
示例3: Hide
//---------------------------------------------------------------------------
void __fastcall TLogin::BitBtn1Click(TObject *Sender){
AnsiString sql;
int id, ver;
if(RG->ItemIndex==1){
sql.printf("select id, pass, version from login where login='%s'",Name->Text);
DM->dsLogin->Close();
DM->dsLogin->SelectSQL->Clear();
DM->dsLogin->SelectSQL->Add(sql);
DM->dsLogin->Open();
sql=DM->dsLogin->FieldByName("PASS")->AsString;
id=DM->dsLogin->FieldByName("ID")->AsInteger;
ver=DM->dsLogin->FieldByName("VERSION")->AsInteger;
if (ver!=104){
Application->MessageBox("Текущая версия программы устарела. Обновите программу.", "Ошибка", MB_OK);
return;
}
if(Pass->Text==sql){
Login->Tag=id;
Hide();
FirstForm->ShowModal();
Close();
}else{
Application->MessageBox("Неправильный пароль!", "Ошибка", MB_OK);
return;
}
}
Hide();
FirstForm->ShowModal();
Close();
}
示例4: JapanDatum
AnsiString __fastcall TScreenSnapper::JapanDatum(void)
{
static AnsiString Months[]={"","jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"};
SYSTEMTIME St;
GetSystemTime(&St);
AnsiString Tmp;
Tmp.printf("%d-%s-%d",St.wYear,Months[St.wMonth].c_str(),St.wDay);
return Tmp;
}
示例5: GraphMouseMove
//---------------------------------------------------------------------------
void __fastcall TMainForm::GraphMouseMove(TObject *Sender,
TShiftState Shift, int X, int Y)
{
POINT ip = {X, Y};
TLDPoint ldp;
static_cast<TGraph2D*>(Sender)->Pixel2Coord(&ip, &ldp, 1);
AnsiString s;
s.printf("Mouse at (%.2Lf, %.2Lf)", ldp.x, ldp.y);
StatusBar->SimpleText = s;
}
示例6: TreeChange
//---------------------------------------------------------------------------
//При перемещении по древу опеределяем уровень выбранного узла
//и блокуриуем или разблокуруем кнопки панели инструментов
void __fastcall TMainForm::TreeChange(TObject *Sender, TTreeNode *Node){
AnsiString filter;
ToolButton2->Enabled=false;
ToolButton4->Enabled=false;
ToolButton5->Enabled=false;
ToolButton6->Enabled=false;
switch(Node->Level){
case 4: filter.printf("ID=%d",(int*)Node->Data);
DM->dsTree->Filter=filter;
ToolButton4->Enabled=true;
if(DM->dsTree->RecNo!=0){
ToolButton5->Enabled=true;
ToolButton6->Enabled=true;
}
break;
case 3: ToolButton2->Enabled=true;
default:filter.printf("ID=%d",9999);
DM->dsTree->Filter=filter;
}
}
示例7: kmloutput
static AnsiString kmloutput( Location *outgrid )
{
AnsiString kml;
kml.printf(
"%3.8f,"
"%3.8f",
raddeg( outgrid->easting ),
raddeg( outgrid->northing )
);
return kml;
}
示例8: TreePaint
//---------------------------------------------------------------------------
void __fastcall TMainForm::N5Click(TObject *Sender){
AnsiString sql;
sql.printf("delete from spis2 where id=%d",(int)Tree->Selected->Data);
try{
DM->qInsert->SQL->Clear();
DM->qInsert->SQL->Add(sql);
DM->qInsert->ExecQuery();
DM->dsSpis->FullRefresh();
TreePaint();
}catch(const Exception &E){
Application->MessageBox("Удалите сначала книги.", "Ошибка", MB_OK);
}
}
示例9: DeleteBook
//---------------------------------------------------------------------------
void __fastcall TMainForm::DeleteBook(TObject *Sender){
int id, kbook;
AnsiString sql;
id=DM->dsTree->FieldByName("ID")->AsInteger;
kbook=DM->dsTree->FieldByName("KBOOK")->AsInteger;
sql.printf("delete from spisbook where id=%d and kbook=%d",id,kbook);
DM->qInsert->SQL->Clear();
DM->qInsert->SQL->Add(sql);
//DM->qInsert->Prepare();
DM->qInsert->ExecQuery();
DM->dsTree->FullRefresh();
//DM->dsTree->Close();
//DM->dsTree->Open();
}
示例10: setScoreText
//---------------------------------------------------------------------------
void TGJVEditFrame::setScoreText( int dist, bool partial, bool xband )
{
AnsiString b;
AnsiString s;
s.printf( "%d", dist );
if ( partial )
b += "(";
b += s;
if ( partial )
b += ")";
if ( xband )
b += "X";
DistSt->Caption = b;
}
示例11: values
//-----------------------------------------------------------------------------------------------
//Функция создания связки предмета с нужной специальностью и курсом
void __fastcall TMainForm::Button3Click(TObject *Sender){
PredForm->Tag=1;
PredForm->Button1->Visible=true;
if(PredForm->ShowModal()==mrOk){
TTreeNode *Node;
AnsiString filter;
int otd,obu,kurs,pred;
//Выбираем мз выбранного узла древа значения курса, специальности и
//формы обучения
otd=PMyRec(Tree->Selected->Data)->otd;
obu=PMyRec(Tree->Selected->Data)->obu;
kurs=PMyRec(Tree->Selected->Data)->kurs;
pred=Tree->Tag;
Tree->Tag=0;
//Проверяем нет ли такого предмета на данном курсе выбранной специальности
filter.printf("KOTD=%d and FOBUCH=%d and KURS=%d and KPRED=%d",otd,obu,kurs,pred);
DM->dsSpis->Filter=filter;
//если есть выводим предупреждающее сообщение и завершаем процедуру
if(DM->dsSpis->RecNo!=0){
Application->MessageBox("Такая связка уже есть.", "Look", MB_OK);
}else{
//если нет - создаем нужную связку в таблице
AnsiString sql;
sql.printf("insert into spis2 (kotd,kpred,kurs,fobuch) values (%d,%d,%d,%d)",otd,pred,kurs,obu);
DM->qInsert->SQL->Clear();
DM->qInsert->SQL->Add(sql);
DM->qInsert->Prepare();
DM->qInsert->ExecQuery();
DM->dsSpis->Close();
DM->dsSpis->Open();
//Добавляем в древо новый узел
Tree->Items->AddChildObject(Tree->Selected,DM->dsSpis->FieldByName("N_PREDMET")->AsString,\
(void*)DM->dsSpis->FieldByName("ID")->AsInteger);
}
}
}
示例12: vi
PTRADE_API void __stdcall get_version( char * name, int name_size,char * version,int version_size)
{
lstrcpyn(name,PLUGINNAME,name_size);
try
{
VersionInfo vi("PTrdSQJSF.dll");
AnsiString strVer;
strVer.printf("%d.%d.%d.%d",vi.productMajorVersion(),
vi.productMinorVersion(),
vi.productBuild(),
vi.productSubBuild());
lstrcpyn(version,strVer.c_str(), version_size);
}
catch(...)
{
lstrcpyn(version,"0.0.0.0", version_size);
}
}
示例13: LocatorMultTreeGetText
void __fastcall TMultDispFrame::LocatorMultTreeGetText(
TBaseVirtualTree */*Sender*/, PVirtualNode Node, TColumnIndex /*Column*/,
TVSTTextType /*TextType*/, UnicodeString &CellText )
{
if ( Node->States.Contains( vsHasChildren ) )
CellText = ct->locs.llist[ Node->Index ] ->loc;
else
{
String dispLine;
for (int i = 0; ct->locs.llist.size() && i < 10; i++)
{
unsigned char *lc = ct->locs.llist[ Node->Parent->Index ] ->map( Node->Index * 10 + i );
AnsiString disp;
disp.printf( "%2.2d", Node->Index * 10 + i );
if ( lc && *lc )
dispLine += disp + " (" + *lc + ") ";
}
CellText = dispLine;
}
}
示例14: FormCreate
void __fastcall TForm_About::FormCreate(TObject *Sender)
{
AnsiString as;
lb_BuildDate->Caption = "Build date: " + AnsiString( __DATE__ );
unsigned int major_ver;
unsigned int minor_ver;
unsigned int release_num;
unsigned int build_num;
// get flash tool (UI) verison
GetVersion(&major_ver, &minor_ver, &release_num, &build_num);
// VersionInfo->Caption = "FlashTool v" + IntToStr(major_ver) + "." + IntToStr(minor_ver) + "." + IntToStr(release_num) + "." + IntToStr(build_num);
as.printf("FlashTool v%u.%04u.%02u.%02u", major_ver, minor_ver, release_num, build_num);
VersionInfo->Caption = as;
#ifdef _DEBUG
as = VersionInfo->Caption;
as = as+" (DEBUG version) ";
VersionInfo->Caption = as;
#endif /* #ifdef _DEBUG */
const char *p_version, *p_release_type, *p_build_date;
// get the brom dll information
Brom_GetDLLInfo(&p_version, &p_release_type, &p_build_date, NULL);
as.printf("%s", p_version);
brom_dll_version->Caption = as;
as.printf("%s", p_release_type);
brom_dll_release_type->Caption = as;
as.printf("(Build-Date: %s)", p_build_date);
brom_dll_build_date->Caption = as;
// get the meta dll information
META_GetDLLInfo(&p_version, &p_release_type, &p_build_date, NULL);
as.printf("%s", p_version);
meta_dll_version->Caption = as;
as.printf("%s", p_release_type);
meta_dll_release_type->Caption = as;
as.printf("(Build-Date: %s)", p_build_date);
meta_dll_build_date->Caption = as;
}
示例15: dump
void dump(int n1,int n2,int n3,double Re,double ****f1,double ***nut,double t_cur,long count)
{
FILE *fd;
AnsiString tmp;
AnsiString tmp2 = NameDumpFile;
tmp.printf("%d",num_dump);
fd = fileopen(tmp2.Insert(tmp,tmp2.Pos(".")),0);
nmessage("dump is done",t_cur);
MainWindow->ChangeStatus("","—брос данных в файл є"+tmp);
fprintf(fd,"current time = %0.10f \ncurrent iteration = %ld\n",t_cur,count);
fprintf(fd,"Number of points along x = %d\n",n1);
fprintf(fd,"Number of points along y = %d\n",n2);
fprintf(fd,"Number of points along z = %d\n",n3);
fprintf(fd,"Reynolds number = %lf\n",Re);
print_array3d(fd,f1[0],0,m1,0,m2,0,m3);
print_array3d(fd,f1[1],0,m1,0,m2,0,m3);
print_array3d(fd,f1[2],0,m1,0,m2,0,m3);
print_array3d(fd,f1[3],0,m1,0,m2,0,m3);
print_array3d(fd,nut,0,m1,0,m2,0,m3);
fclose(fd);
num_dump++;
}