Re: Trouble of GDI+ generic error!
- From: "James Wong" <cphk_msdn2@xxxxxxxxxxxxx>
- Date: Mon, 26 Mar 2007 12:31:05 +0800
Hi Steven,
I still have something not quite sure about when I should call Dispose. The
followings are some pseudo code to show my question:
Public Shared Sub A()
Dim objFont As Font
objFont = New Font (...)
Call B (objFont)
' I should call objFont.Dispose here before end of the sub, right?
Call B (New Font (...))
' if I call sub B in this way (without creating a variable), how can I
call Dispose?
End Sub
Public Shared Sub B(ByVal objFont As Font)
'... do something here with objFont
' Do I need to call objFont.Dispose here before end of the sub?
' I'm not quite sure that objFont in this sub is an independent instance
from objFont in Sub A
End Sub
And you may right that I use a lot of font objects to print and this may be
the major cause of my problem.
Thanks again for your help!
Regards,
James Wong
"Steven Cheng[MSFT]" <stcheng@xxxxxxxxxxxxxxxxxxxx> ¼¶¼g©ó¶l¥ó·s»D:Nc%23lgPUbHHA.2256@xxxxxxxxxxxxxxxxxxxxxxxxx
Hi James,
For those graphics objects such as Brush, Bitmap, Font... they will hold
win32 unmanaged resource handle, thus, whenever you have used large number
of such objects and haven't explcitly dispose them at ealiear time,
they'll
hold significant operating system resource(GDI handles). Therefore, you're
recommended to explicitly dispose them after finishing use them.
Sincerely,
Steven Cheng
Microsoft MSDN Online Support Lead
This posting is provided "AS IS" with no warranties, and confers no
rights.
.
- Follow-Ups:
- Re: Trouble of GDI+ generic error!
- From: Steven Cheng[MSFT]
- Re: Trouble of GDI+ generic error!
- References:
- Trouble of GDI+ generic error!
- From: James Wong
- RE: Trouble of GDI+ generic error!
- From: Steven Cheng[MSFT]
- Re: Trouble of GDI+ generic error!
- From: James Wong
- Re: Trouble of GDI+ generic error!
- From: Steven Cheng[MSFT]
- Re: Trouble of GDI+ generic error!
- From: James Wong
- Re: Trouble of GDI+ generic error!
- From: Dennis
- Re: Trouble of GDI+ generic error!
- From: James Wong
- Re: Trouble of GDI+ generic error!
- From: Steven Cheng[MSFT]
- Trouble of GDI+ generic error!
- Prev by Date: Re: BE-CAREFUL, YOU COULD BE A VICTIM OF SCAM OR FRAUD!!!
- Next by Date: Create a program by copying an existing program
- Previous by thread: Re: Trouble of GDI+ generic error!
- Next by thread: Re: Trouble of GDI+ generic error!
- Index(es):
Relevant Pages
|
Loading