示例#1
0
        private IntPtr IconDataCallback(CAIROWINNOTIFYICONIDENTIFIER iconData)
        {
            NotifyIcon icon = null;

            foreach (NotifyIcon ti in TrayIcons)
            {
                if ((iconData.guidItem != Guid.Empty && iconData.guidItem == ti.GUID) || (ti.HWnd == (IntPtr)iconData.hWnd && ti.UID == iconData.uID))
                {
                    icon = ti;
                    break;
                }
            }

            if (icon != null || iconData.guidItem == new Guid(VOLUME_GUID))
            {
                if (iconData.dwMessage == 1)
                {
                    return(Interop.Shell.MakeLParam(GetSystemMetrics(0) - 23, 0));
                }
                else if (iconData.dwMessage == 2)
                {
                    return(Interop.Shell.MakeLParam(23, 23));
                }
            }

            return(IntPtr.Zero);
        }
示例#2
0
        private IntPtr IconDataCallback(CAIROWINNOTIFYICONIDENTIFIER iconData)
        {
            NotifyIcon icon = null;

            foreach (NotifyIcon ti in TrayIcons)
            {
                if ((iconData.guidItem != Guid.Empty && iconData.guidItem == ti.GUID) || (ti.HWnd == (IntPtr)iconData.hWnd && ti.UID == iconData.uID))
                {
                    icon = ti;
                    break;
                }
            }

            if (icon != null)
            {
                if (iconData.dwMessage == 1)
                {
                    return(Shell.MakeLParam(icon.Placement.left, icon.Placement.top));
                }
                else if (iconData.dwMessage == 2)
                {
                    return(Shell.MakeLParam(icon.Placement.right, icon.Placement.bottom));
                }
            }
            else if (iconData.guidItem == new Guid(VOLUME_GUID))
            {
                if (iconData.dwMessage == 1)
                {
                    return(Shell.MakeLParam(defaultPlacement.left, defaultPlacement.top));
                }
                else if (iconData.dwMessage == 2)
                {
                    return(Shell.MakeLParam(defaultPlacement.right, defaultPlacement.bottom));
                }
            }

            return(IntPtr.Zero);
        }