#endif
#ifdef BACKIMAGE
Canvas->Draw(0, 0,backimage);
#else
Canvas->Pen->Color = Canvas->Brush->Color;
Canvas->Rectangle(0,0,ClientWidth,ClientHeight);
#endif
// joriy oyning kalendarini chiqarish
Canvas->Brush->Style = bsClear;
Canvas->Font->Size = 12;
Canvas->Font->Color = clBlack;
Canvas->TextOutW(x0,y0-35, stMonth[aMonth-1]);
Canvas->Font->Size = 10;
// yangi kolonka – hafta kuning nomi
x = x0 - 30;
y = y0;
for (i=0;i<7;i++)
{
if (i<5)
Canvas->Font->Color = clBlack;
else
Canvas->Font->Color = clRed;
Canvas->TextOutW(x,y, stDay[i]);
y += dy;
}
/* oy boshlanadigan hafta kunining nomini aniqlash */
aDayOfWeek = DayOfTheWeek(EncodeDate(aYear,aMonth,1));
x = x0;
y = y0 + dy * (aDayOfWeek-1);
for (i = 1; i <= DaysInAMonth(aYear,aMonth); i++)
{
// kunni bayram hisoblanishini aniqlash
st = IntToStr_(i) + "." + IntToStr_(aMonth);
if (holiday.Pos(st) !=0)
Canvas->Font->Color = clRed; // bayramga tegishli
else // odatiy
if (aDayOfWeek < 6)
Canvas->Font->Color = clBlack;
else // shanba yoki yakshanba
Canvas->Font->Color = clRed;
Canvas->TextOutW(x,y,IntToStr(i));
if (i == aDay) {
// bugungi kunni belgilash
// ramka
Canvas->Brush->Style = bsClear;
Canvas->Pen->Color = clGray;
Canvas->Rectangle(x-3,y-1,x+dx-2,y+dy-1);
}
if (aDayOfWeek != 7) {
y += dy;
aDayOfWeek ++;
}
else {
aDayOfWeek =1;
x += dx;
y = y0;
}
}
}
// UpDown komponent tugmasini bosish
void __fastcall TForm1::UpDown1Click(TObject *Sender, TUDBtnType Button)
{
switch (UpDown1->Position) {
case 0 : UpDown1->Position = 12; aYear--; break;
case 13: UpDown1->Position = 1; aYear++; break;
}
aMonth = UpDown1->Position;
Paint(); // Kalendarni qayta yuklash
}
// Sichqoncha tugmasini qo’yib yuborish
void __fastcall TForm1::FormMouseUp(TObject *Sender, TMouseButton Button, TShiftState Shift,
int X, int Y)
{
// oynani sichqoncha ko’rsatgichi joylashgan ekran
// nuqtasiga ko’chirish
Form1->Left = Form1->Left + X;
Form1->Top = Form1->Top + Y;
}
// tugmani bosish
void __fastcall TForm1::FormKeyDown(TObject *Sender, WORD &Key, TShiftState Shift)
{
if ( Key == 27) // tugmasi
Form1->Close(); // Dastur ishini tugatish
}
Qo’ng’iroq
Qo’ng’iroq dasturi (1.76-rasm) foydalanuvchi o’rnatgan vaqtda xabarni chiqaradi.
1.76-rasm. Qo’ng’iroq dastur oynasi
Foydalanuvchi xabarni, vaqtni kiritgandan va OK tugmani bosgandan so’ng, dastur oynasi ekrandan yo’qoladi (kichiklashadi). O’rnatilgan vaqtda Qo’ng’iroq oynasi ekranda paydo bo’ladi. Dasturning boshqalaridan asosiy farqi, dasturning ishlayotganini bildiruvchi nishonchasi (qachonki oyna kichraytirilganda), masalalar panelida emas, masalalar panelining tizimli soxasida (System Tray) tasvirlanadi (1.77-rasm). Sichqoncha ko’rsatkichini dastur nishonchasiga keltirilganda, budilnik o’rnatilgan vaqt ko’rsatiladi (1.78-rasm), o’ng tugmani bosishda, dastur ishini tugatishga yoki uning oynasini tiklashga imkon beruvchi bo’yruqlardan iborat kontekstli menyu xosil bo’ladi.
Do'stlaringiz bilan baham: |