1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| void __fastcall TfEssaiXE6::bImagesClick(TObject *Sender)
{
int x1, y1, h, dy, largeur, hauteur, i, Nb, ymax, rayon, iTop;
TImage** TabImages;
largeur = Image2->Width;
hauteur = Image2->Height;
x1 = Image2->Left + largeur/2;
y1 = Image2->Top;
h = hauteur;
TCanvas *pcanvas = Image2->Canvas;
pcanvas->Brush->Color = clWhite;
TRect aRect = TRect(0, 0, largeur, hauteur);
pcanvas->FillRect(aRect);
Nb = 30;
dy = h/Nb;
ymax = y1 + h - dy;
rayon = 5;
// Création des images
TabImages = new TImage*[Nb];
TabImages[i]->Canvas->Brush->Color = clRed;
for(i = 0; i < Nb; i++)
{
TabImages[i] = new TImage(Application);
TabImages[i]->Parent = fEssaiXE6;
TabImages[i]->SetBounds(x1 - rayon, y1 + i*dy, x1 + rayon, y1 + i*dy + 2*rayon);
TabImages[i]->Canvas->Brush->Color = clRed;
TabImages[i]->Canvas->Ellipse(0, 0, 2*rayon, 2*rayon);
}
while(!cbStop->Checked)
{
for(i = 0; i < Nb; i++)
{
iTop = TabImages[i]->Top;
iTop++;
if( iTop > ymax) iTop = iTop - Nb*dy;
TabImages[i]->Top = iTop;
Application->ProcessMessages();
}
Application->ProcessMessages();
Sleep(10);
}
Application->ProcessMessages();
delete [] TabImages; |
Partager