Thanks Stoyan,
I followed your advice and I changed the method as follows and the problem
seems to have gone away - I have used the control for several hours now
without any errors:
1. I changed the declaration of the callback to accept a HandleRef in
place of the hDC handle,
2. I moved the delegate type variable to the method where it is used
rather than holding onto a class-level variable,
3. I changed the method which calls the callback as follows:

Private Overloads Sub GetAvailableFontInfo(ByVal FontName As String)
Etc...
Dim pHDCHandleRef As HandleRef
Dim pGCHandle As GCHandle = GCHandle.Alloc(Me)

Try
Etc...
phDC = pGraphics.GetHdc
pHDCHandleRef = New HandleRef(pGraphics, phDC)
Etc...
pResult = EnumFontFamiliesEx(pHDCHandleRef, pLogFont, AddressOf
Me.EnumFontInfoCallback, IntPtr.Zero, 0)
Etc...

Finally
pGCHandle.Free()
Etc...
End Try
End Sub

Thanks for your help,
Regards
John Whattam.

===================================
This list is hosted by DevelopMentorĀ®  http://www.develop.com

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to