Much thanks,
JJ
AliR.
"James Juno" <j...@asteroid.fake> wrote in message
news:X46dnQZtG5rgkdXV...@scnresearch.com...
http://msdn.microsoft.com/en-us/library/2ek64h34(VS.71).aspx
"When you finish with the CFont object created by the CreateFont
function, first select the font out of the device context, then delete
the CFont object."
-JJ
AliR.
"James Juno" <j...@asteroid.fake> wrote in message
news:VIOdnTBN6LjyjdXV...@scnresearch.com...
>Most of the member function descriptions involving font creation either
>explicitly state it or otherwise show it in their example snippets. For
>instance,
>
>http://msdn.microsoft.com/en-us/library/2ek64h34(VS.71).aspx
>
>"When you finish with the CFont object created by the CreateFont
>function, first select the font out of the device context, then delete
>the CFont object."
As CFont is derived from CGdiObject, DeleteObject will be called on the GDI
font when the CFont object is destroyed. You don't need to call
DeleteObject yourself unless you want to delete the GDI font before the
CFont is destroyed.
--
Doug Harrison
Visual C++ MVP
Thanks. Although it doesn't hurt anything, I can stop making redundant
calls to DeleteObject() on CFont objects. I've been doing that for
years. ;)
-JJ
{
CFont f;
f.CreateFont(...);
CFont * old = dc.SelectObject(&f);
...
dc.SelectObject(old);
} // <== CFont object is deleted here
Why did you assume that "delete the CFont object" had anything to do with "Call
DeleteObject on the CFont"?
joe
On Thu, 05 Jun 2008 09:12:30 -0700, James Juno <j...@asteroid.fake> wrote:
Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm