GDI and GDIplus
-
Hello, Can GDI and GDIplus co-exist in the VC project. I am thinking of mixing use of these libraries. My existing library is using GDI but it seems that GDIplus has some cool functions which I think it would great to incorporate into it also. Possible? Would it crash or lib conflict? thank you.
-
Hello, Can GDI and GDIplus co-exist in the VC project. I am thinking of mixing use of these libraries. My existing library is using GDI but it seems that GDIplus has some cool functions which I think it would great to incorporate into it also. Possible? Would it crash or lib conflict? thank you.
Hi I haven't used GDI+ but inspecting the GDI+ Graphics class, I see a constructor that takes a HDC, so you should be able to mix the 2. Martin
-
Hello, Can GDI and GDIplus co-exist in the VC project. I am thinking of mixing use of these libraries. My existing library is using GDI but it seems that GDIplus has some cool functions which I think it would great to incorporate into it also. Possible? Would it crash or lib conflict? thank you.
Yes they can coexist. But the trick is getting the HDC for GDI drawing. You have to first create the Gdiplus::Graphics object that you will do all your drawing on, then call Graphics::GetHDC to get the HDC you need for your GDI calls. If you draw on a HDC with GDI and then try to attach a Graphics object to the same HDC the Graphics constructor will erase all the drawing you have done. Lookup Graphics::GetHDC and Graphics::ReleaseHDC in MSDN for more info.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03 "Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04 Within you lies the power for good - Use it!
Honoured as one of The Most Helpful Members of 2004