displaying png's with GDI+
-
hi im trying to get my head around GDI+ as far as i can tell i can only use it in the main function. With what i've done below the image shows up at first but when the window refreshes i.e (change the size of it) the image disappears is not repainted. main.. GdiplusStartupInput gdiplusStartupInput; ULONG_PTR gdiplusToken; GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); { Graphics graphics(GetDC(hwnd)); Image* image = new Image(L"clock2alpha.png"); Bitmap bitmap(L"clock2alpha.png"); graphics.DrawImage(&bitmap, 0, 0); } GdiplusShutdown( gdiplusToken ); ..... im interested in displaying png images and how to access them outside the main method with GDI+ thank you
-
hi im trying to get my head around GDI+ as far as i can tell i can only use it in the main function. With what i've done below the image shows up at first but when the window refreshes i.e (change the size of it) the image disappears is not repainted. main.. GdiplusStartupInput gdiplusStartupInput; ULONG_PTR gdiplusToken; GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); { Graphics graphics(GetDC(hwnd)); Image* image = new Image(L"clock2alpha.png"); Bitmap bitmap(L"clock2alpha.png"); graphics.DrawImage(&bitmap, 0, 0); } GdiplusShutdown( gdiplusToken ); ..... im interested in displaying png images and how to access them outside the main method with GDI+ thank you
-
hi im trying to get my head around GDI+ as far as i can tell i can only use it in the main function. With what i've done below the image shows up at first but when the window refreshes i.e (change the size of it) the image disappears is not repainted. main.. GdiplusStartupInput gdiplusStartupInput; ULONG_PTR gdiplusToken; GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, NULL); { Graphics graphics(GetDC(hwnd)); Image* image = new Image(L"clock2alpha.png"); Bitmap bitmap(L"clock2alpha.png"); graphics.DrawImage(&bitmap, 0, 0); } GdiplusShutdown( gdiplusToken ); ..... im interested in displaying png images and how to access them outside the main method with GDI+ thank you
Lamefif wrote:
as far as i can tell i can only use it in the main function.
Where did you get that idea? :)
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
-
Lamefif wrote:
as far as i can tell i can only use it in the main function.
Where did you get that idea? :)
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
-
hey Mark :) i dont know what i did earlier but it keept crashing at runtime, when i put the code above in a method it was weird. thank for your replies guys.
Lamefif wrote:
keept crashing at runtime, when i put the code above in a method
hmm It was something else probably. You can make GDI+ calls anywhere (of course, all the usual thread safety issues apply if you're using multiple threads). If you're using GDI+ extensively, you can do the GdiplusStartup() just once - main/winmain is fine - and call GdiplusShutdown() just once after all drawing is done - just before returning from main/winmain is fine. If you have trouble in other functions you can always post related sample code here :) Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
-
hey Mark :) i dont know what i did earlier but it keept crashing at runtime, when i put the code above in a method it was weird. thank for your replies guys.
Whats the error and where you used your code?
WhiteSky