mercredi 28 février 2018

Visual Studio gdiplus Rendering Images

I am trying to use the gdiplus library in Microsoft Visual Studios 2017 to render an image on the desktop of my Windows 10 computer. I have loaded the image that I want to render into the program with the following lines:

GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;
GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL);

Image* image = Image::FromFile(_T("C:\\whatever\\Image00.png"));

Graphics *pGraphics = new Graphics(image);

pGraphics->Clear(0xffffffff);

Rect sizeR(0, 0, image->GetWidth(), image->GetHeight());

pGraphics->DrawImage(image, sizeR, 0, 0, (int)image->GetWidth(), (int)image->GetHeight(), UnitPixel);

The "DrawImage" function did not render anything to my screen, however. Does anyone know how I can proceed from here? The image needs to be full screen. I do not want to call on Microsoft Paint or Photo Viewer to render this image, I want the program to render the image by itself.

Aucun commentaire:

Enregistrer un commentaire