1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
| void __fastcall TForm1::Button3Click(TObject *Sender)
{
Graphics::TBitmap *pBitmap = new Graphics::TBitmap();
// Cet exemple montre le dessin direct dans le Bitmap
Byte *ptr;
try
{
pBitmap->LoadFromFile("C:\\DocumentsandSettings\\attyiddir\\mes documents\\Nouveau dossier\\kahina.bmp ");//le chemin d'une image bitmap
for (int y = 0; y < pBitmap->Height; y++)
{
ptr = (Byte *)pBitmap->ScanLine[y];
for (int x = 0; x < pBitmap->Width; x++)
ptr[x] = (Byte)y;
}
Canvas->Draw(0,0,pBitmap);
}
catch (...)
{
ShowMessage("Impossible de charger ou modifier le bitmap");
}
delete pBitmap;
} |
Partager