I have the following code:
VB Code:
Private Sub UpdateIcon(ByVal txt As String, ByVal col As Color) Dim bmp As New Bitmap(16, 16) Dim G As Graphics = Graphics.FromImage(bmp) Dim oIcon As Icon G.Clear(Color.FromArgb(cserver.BackgroundIcon)) G.DrawString(txt, New Font("Tahoma", 9, FontStyle.Bold), New SolidBrush(col), -2, 0) oIcon = Icon.FromHandle(bmp.GetHicon) StatusIcon.Icon = oIcon End Sub
Problem is that every time the function is called, the StatusIcon.Icon call leaks 2 GDI hanldes.
Is there an alternative implementation?
I checked MSDN and apparently this was fixed in Framework 1.0 SP2 for Form.Icon. I can't find a reference anywhere to NotifyIcon GDI Leaks.
Help! I'm comletely stuck on this!
Cheers,




Reply With Quote