예제 #1
0
        internal void ShowWallpaper(Control renderControl)
        {
            IntPtr windowHandle = IntPtr.Zero;

            WallpaperManager.UIInvoke(() =>
            {
                try
                {
                    Controls.Clear();
                    renderControl.Dock = DockStyle.Fill;
                    Controls.Add(renderControl);
                    Opacity = 1;
                    Refresh();
                    windowHandle = Handle;
                }
                catch (Exception ex)
                {
                }
            });
            WallpaperHelper.GetInstance(_screenIndex).SendToBackground(windowHandle);
        }
예제 #2
0
        public static RenderHost GetHost(uint screenIndex = 0, bool autoCreate = true)
        {
            if (!_hosts.ContainsKey(screenIndex))
            {
                if (autoCreate)
                {
                    WallpaperManager.UIInvoke(() =>
                    {
                        var host = _hosts[screenIndex] = new RenderHost(screenIndex);
                        host.Show();
                    });
                }
            }

            if (_hosts.ContainsKey(screenIndex))
            {
                return(_hosts[screenIndex]);
            }
            else
            {
                return(null);
            }
        }