int j = 0; //"a" tugun nomeri
while (j < q->ChildNodes ->Count)
{
a= q ->ChildNodes->Nodes[j];
switch (j) {
case 0 : RadioButton1->Caption=a->Text;
RadioButton1->Top=Label1->Top+Label1->Height+10;
RadioButton1->Visible = true;
break;
case 1 : RadioButton2->Caption=a->Text;
RadioButton2->Top=RadioButton1->Top+RadioButton1
->Height+10;
RadioButton2->Visible = true;
break;
case 2 : RadioButton3->Caption=a->Text;
RadioButton3->Top=RadioButton2->Top +
RadioButton2-> Height + 10;
RadioButton3->Visible =true;
break;
}
j++;
}
return 0;
}
//test xaqida ma’lumot
void __fastcall TForm1::Info()
{
Form1->Caption = XMLDocument1->DocumentElement->
ChildNodes->Nodes[WideString("head")]->Text;
Label1->Caption = XMLDocument1->DocumentElement->
ChildNodes->Nodes[WideString("description")]->Text;
}
//OK tugmani bosish
void __fastcall TForm1::Button1Click(TObject *Sender)
{
static int i = 0; //savol nomeri
int r; //savolni chiqarish natijasi:
// -1 – savollar boshqa yo’q
switch (mode) {
case 0:
r=Qery(i++);
mode = 1;
break;
case 1:
//topshiruvchi to’g’ri javob berganini tekshirish
if (Sel==Right) nRight++;
//keyingi savolni chiqarish
r=Qery(i++);
if (r == -1) //savollar boshqa yo’q
{
//testlash natijasi
Result();
Button1->Enabled = true;
mode = 2;
}
break;
case 2: Form1->Close();//dastur ishini tugatadi
}
}
//testlash natijasini chiqarish
void __fastcall TForm8::Result()
{
int i = 0;
int score;
_di_IXMLNode ls;//levels tuguniga murojaat interfeysi
_di_IXMLNode l;//level tuguniga murojaat interfeysi
//level tugunlarini ketma-ket o’qish va to’g’ri
//javoblar soni bo’lgan score parametri qiymati bilan
//taqqoslash
ls = XMLDocument1->DocumentElement->ChildNodes->
Nodes[WideString("levels")];
while (iChildNodes->Count)
{
l=ls->ChildNodes->Nodes[i];
score = StrToInt( l->
GetAttribute(WideString("score")));
if ( nRight>= score ) break;
i++;
}
AnsiString mes;
mes.printf("Imtihon tugadi\n "
"umumiy natijalar: % i \ n "
"to’g’ri javob: %i\n",nQuery,nRight);
mes = mes + l->GetAttribute(WideString("text"));
Label1->Width = Form8->ClientWidth -20;
Label1->Caption = mes;
}
//foydalanuvchi birinchi javobni tanladi
void __fastcall TForm1::RadioButton1Click(TObject *Sender)
{
Sel = 1;
Button1->Enabled = true;
}
//foydalanuvchi ikkinchi javobni tanladi
void __fastcall TForm1::RadioButton2Click(TObject *Sender)
{
Sel = 2;
Button1->Enabled = true;
}
//foydalanuvchi uchinchi javobni tanladi
void __fastcall TForm1::RadioButton3Click(TObject *Sender)
{
Sel = 3;
Button1->Enabled = true;
}
Kalendar
Kalendar dasturi joriy oyning kalendar tasvirini chiqaradi. Bayram kunlarini berish imkoniyatiga ega. O’zgartirilgan sana funksiyalari bilan ishlashda forma yuzasiga grafikni chiqarish namoish etiladi. Dastur forma va oynasi 1.75-rasmda keltirilgan. Ko’rinadiki, oyna sarlavhasi dastur ishlash vaqtida tasvirlanmaydi (BorderStyle xususiyati qiymati bsNone ga teng bo’ladi), lekin foydalanuvchi kalendarni o’zini sichqoncha bilan “ushlab” oynani ko’chirishi mumkin. Kalendarni (dastur oynasini) to’g’ridan-to’g’ri ko’chirish, sichqoncha tugmalarini qo’yib yuborgan vaqtda xosil bo’ladigan MouseUp xodisani qayta ishlash funksiyasi bajaradi.
Do'stlaringiz bilan baham: |