none
Windows 7 NotifyIcon: Icon does not show correctly!!

    Question

  • Here's the code I've used. I don't know what the problem is. You can compare the result of the icon when it's shown in the glass area of the task bar and when it's shown with the white background.

    Thanks for your helps.

    Here's the pic:

    http://www.tehranpic.net/images/boc1s54c8o85argjp983.png

     

          NotifyIcon notIco = new NotifyIcon();
          notIco.Icon = Properties.Resources.tray;
    
          notIco.Text = "Form1 (NotifyIcon example)";
          notIco.Visible = true;
          notIco.Click += new EventHandler(notIco_Click);



    CPU: Core2 Due E7300 2.66GHz, RAM: 4GB DDR2, OS:Windows 7 Ultimate, HDD: 1TB SATA II, VGA: 1GB ATI , Compiler: VS 2008 Pro Sp1
    • Edited by Alireza Noori Tuesday, May 18, 2010 1:33 PM Forgot to upload picture.
    Tuesday, May 18, 2010 10:23 AM

All replies

  • Did you try manual drag-n-drop and then assigning an icon to it through Properties windows.

    If you do so, Form.Designer.cs will have code like this

    // notifyIcon1

     

    //
    this.notifyIcon1.Icon = ((System.Drawing.Icon)(resources.GetObject("notifyIcon1.Icon")));
    this.notifyIcon1.Text = "notifyIcon1";=
    this.notifyIcon1.Visible = true;

    I would recommend manual drag-n-drop, by the way, where did you place the above mentioned code.

    I hope this helps.


    Vidya Vrat Agarwal. MCPD,MCTS, MCT, MCSD .NET, MCAD .NET, MCSD. http://dotnetpassion.blogspot,com
    • Marked as answer by Alireza Noori Tuesday, May 18, 2010 9:48 PM
    • Unmarked as answer by Alireza Noori Tuesday, May 18, 2010 9:48 PM
    Tuesday, May 18, 2010 7:12 PM
  • Thanks for the reply.

    Sorry about the "Mark as answer" thing. I hit the wrong link!!!

    Well, as a matter of fact, this project is a WPF project but I'm using the NotifyIcon class from WinForms since it's not present in WPF. But I don't think that should matter. I mean, if you look at the picture you can see that one of the icons is drawn correct. But why??!

    ---

    Update:

    I created a new WinForms project and tested the icon, it doesn't work when I drag the NotifyIcon from toolbox either.


    CPU: Core2 Due E7300 2.66GHz, RAM: 4GB DDR2, OS:Windows 7 Ultimate, HDD: 1TB SATA II, VGA: 1GB ATI , Compiler: VS 2008 Pro Sp1
    • Edited by Alireza Noori Tuesday, May 18, 2010 9:55 PM Tested on WinForms
    Tuesday, May 18, 2010 9:51 PM
  • did you allocate the icon file to Notifyicon control in the properties window.
    Vidya Vrat Agarwal. MCPD,MCTS, MCT, MCSD .NET, MCAD .NET, MCSD. http://dotnetpassion.blogspot,com
    Tuesday, May 18, 2010 10:25 PM
  • Yes, as a matter of fact I did. I tried both ways (loading from .ico and setting from the properties menu - resource), neither did help! :-/
    CPU: Core2 Due E7300 2.66GHz, RAM: 4GB DDR2, OS:Windows 7 Ultimate, HDD: 1TB SATA II, VGA: 1GB ATI , Compiler: VS 2008 Pro Sp1
    Tuesday, May 18, 2010 11:29 PM
  • a clarification, did you try using NotifyIcon - Properties - Icon and then allocating it an .ico file.

    I am confuded with what you mentioned in your reply above "properties menu - resource".

    Else send me the .ico file and your application folder at vidya_mct@yahoo.com

     


    Vidya Vrat Agarwal. MCPD,MCTS, MCT, MCSD .NET, MCAD .NET, MCSD. http://dotnetpassion.blogspot,com
    Wednesday, May 19, 2010 5:38 AM
  • Yes, I set it from properties menu. Actually I tried all the possible ways to set the icon, none of them made a difference. I tried from properties menu, adding and loading from resource and loading from file dynamically. Also I tried a few icons so I don't think there should be a problem with icon file but since you asked I'm gonna upload it to my skydrive public folder so it will be available for anyone who would want to try it.

    Here 's the link:

    http://cid-8d3e091cc94025b2.skydrive.live.com/self.aspx/.Public/clock.ico

    I think there's a problem drawing the icon on the main area of taskbar. I changed my windows theme to Windows 7 Basic, but it didn't fix it. So the glass effect is not the problem.

    Thanks for replies.


    CPU: Core2 Due E7300 2.66GHz, RAM: 4GB DDR2, OS:Windows 7 Ultimate, HDD: 1TB SATA II, VGA: 1GB ATI , Compiler: VS 2008 Pro Sp1
    Wednesday, May 19, 2010 10:20 PM