[Mono-dev] An generic error occurred in GDI +

Umesh Chape umesh.chpe at gmail.com
Fri May 9 00:03:11 EDT 2008


Hi ,
        I am using MonoTorrent.dll 0.0.0.0 .  on Operating system is Windows
Xp  with sp2.


I got error like this *" An generic error occurred in GDI +" *. I got this
error in *method UpdateNotifyIcon().

*This error got after some hours during downloading.*

The methos is like this ,

*
public void UpdateNotifyIcon()
        {

            try
            {
                if (this.MainBt.WindowState == FormWindowState.Minimized)
                {
                    int iconInt =16;
                    double dl = clientEngine.TotalDownloadSpeed;
                    double ul = clientEngine.TotalUploadSpeed;
                    if (dl == 0 && ul == 0)
                    {
                        // No acivity: show grey mono icon
                        this.MainBt.NotifyIconSystray.Icon =
ResourceHandler.GetIcon("mono_grey", iconInt, iconInt);
                    }
                    else
                    {
                        // Build a system tray icon with downloadspeed
indication
                        if (maxDownload == 0)
                        {
                            maxDownload =
clientEngine.Settings.GlobalMaxDownloadSpeed;
                            // With a minimimum of 16 Kb (1 Kb per pixel)
                            maxDownload = 1024 * 16;
                        }
                        if (maxDownload < dl)
                            // If no MaxDownloadSpeed is given, create your
own temporarily
                            maxDownload = (int)(dl * 1.25);

                        // Calculate the dimensions and position of the
progress indicator
                        int h = (int)(dl / (maxDownload / iconInt));
                        int w = 3;
                        int x = iconInt - w;
                        int y = iconInt - h;


                        Bitmap bmp = new Bitmap(iconInt,
iconInt);

                        Graphics grs = Graphics.FromImage(bmp);
                        grs.DrawIcon(mono, 0, 0);
                        grs.FillRectangle(Brushes.Green, x, y, w, h);
                        Icon sysIcon = Icon.FromHandle(bmp.GetHicon());

                        this.MainBt.NotifyIconSystray.Icon = sysIcon;
                    }

                    // Show info text when hovering over system tray icon
                    string niTxt = Application.ProductName + " " +
Application.ProductVersion
                                   + "\nDown: " +
FormatSpeedValue(dl).ToString()
                                 + " | Up: " +
FormatSpeedValue(ul).ToString();

                    this.MainBt.NotifyIconSystray.Text = niTxt;
                }
            }
            catch (Exception)
            {

                throw;
            }



       }*
        *
-- 
Regards,
Umesh S.Chape
+91 9422228738
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20080509/42f5fd7f/attachment.html 


More information about the Mono-devel-list mailing list