BCB中显示图片BMP和JPEG

 void __fastcall TForm1::FormPaint(TObject *Sender)
{

    //从资源中加载BMP图片显示
    Graphics::TBitmap *pBitmap = new Graphics::TBitmap();
    pBitmap->Handle = LoadBitmap(HInstance, "BMP");
    Canvas->Draw(0, 0, pBitmap);
    delete pBitmap;

 

    //从文件中加载JPEG图片显示 ,加入头文件#include <jpeg.hpp>  

    TJPEGImage *pJPEG = new TJPEGImage;
    pJPEG->LoadFromFile("d://moon.jpeg");
    Canvas->Draw(300, 0, pJPEG);
}

你可能感兴趣的:(图片)