GDI+ image in ein TImage kopieren



  • Hallo,
    irgendwie stehe ich jetzt auf dem Schlauch. Ich möchte ein mit GDI+ geladenes Bild in einem TImage anzeigen.
    Was ich bisher probiert habe funktioniert leider nicht.

    Gdiplus::Graphics graphic(Image1->Picture->Bitmap->Handle,NULL);
    Gdiplus::Image image(L"pic.gif");
    Image1->Picture->Bitmap->Width = image.GetWidth();
    Image1->Picture->Bitmap->Height = image.GetHeight();
    graphic.DrawImage(&image,0,0);
    

    Irgendwie stehe ich jetzt auf dem Schlauch. 😞



  • GdiplusStartupInput gdiplusStartupInput;
      Gdiplus::ULONG_PTR gdiplusToken;
      Bitmap* bitmap;
      Image* pImg;
    
      GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);
      bitmap = new Bitmap((WideString)AFile);
    
      pImg = bitmap->FromFile((WideString)AFile,0);
      HBITMAP HBM=FBitmap->ReleaseHandle();
      bitmap->GetHBITMAP(0,&HBM);
      FBitmap->Handle=HBM;
      delete pImg;
      delete bitmap;
      GdiplusShutdown(gdiplusToken);
    

    //FBitmap ist ein Borland BCB- TBitmap- objekt
    //AFile ist der Dateiname als AnsiString


Anmelden zum Antworten