示例#1
0
        /// <summary>Updates the thumbnail's display settings.</summary>
        /// <param name="destination">Drawing region on destination window.</param>
        /// <param name="source">Origin region from source window.</param>
        /// <param name="opacity">Opacity. 0 is transparent, 255 opaque.</param>
        /// <param name="visible">Visibility flag.</param>
        /// <param name="onlyClientArea">If true, only the client area of the window will be rendered. Otherwise, the borders will be be rendered as well.</param>
        public void Update(Rectangle destination, Rectangle source, byte opacity, bool visible, bool onlyClientArea)
        {
            if (source.Width < 1 || source.Height < 1)
            {
                throw new ArgumentException("Thumbnail source rectangle cannot have null or negative size.");
            }

            //Full update
            NativeMethods.DwmThumbnailProperties prop = new NativeMethods.DwmThumbnailProperties();
            prop.dwFlags = NativeMethods.DwmThumbnailFlags.RectDestination |
                           NativeMethods.DwmThumbnailFlags.RectSource |
                           NativeMethods.DwmThumbnailFlags.Opacity |
                           NativeMethods.DwmThumbnailFlags.Visible |
                           NativeMethods.DwmThumbnailFlags.SourceClientAreaOnly;

            prop.rcDestination         = new Native.RECT(destination);
            prop.rcSource              = new Native.RECT(source);
            prop.opacity               = opacity;
            prop.fVisible              = visible;
            prop.fSourceClientAreaOnly = onlyClientArea;

            if (NativeMethods.DwmUpdateThumbnailProperties(this, ref prop) != 0)
            {
                throw new DwmCompositionException(Resources.ExceptionMessages.DwmThumbnailUpdateFailure);
            }
        }
示例#2
0
        /// <summary>Updates the thumbnail's display settings.</summary>
        /// <param name="destination">Drawing region on destination window.</param>
        /// <param name="opacity">Opacity. 0 is transparent, 255 opaque.</param>
        /// <param name="visible">Visibility flag.</param>
        /// <param name="onlyClientArea">If true, only the client area of the window will be rendered. Otherwise, the borders will be be rendered as well.</param>
        public void Update(Rectangle destination, byte opacity, bool visible, bool onlyClientArea)
        {
            //Partial update
            NativeMethods.DwmThumbnailProperties prop = new NativeMethods.DwmThumbnailProperties();
            prop.dwFlags = NativeMethods.DwmThumbnailFlags.RectDestination |
                           NativeMethods.DwmThumbnailFlags.Opacity |
                           NativeMethods.DwmThumbnailFlags.Visible |
                           NativeMethods.DwmThumbnailFlags.SourceClientAreaOnly;

            prop.rcDestination         = new Native.RECT(destination);
            prop.opacity               = opacity;
            prop.fVisible              = visible;
            prop.fSourceClientAreaOnly = onlyClientArea;

            if (NativeMethods.DwmUpdateThumbnailProperties(this, ref prop) != 0)
            {
                throw new DwmCompositionException(Resources.ExceptionMessages.DwmThumbnailUpdateFailure);
            }
        }
示例#3
0
        /// <summary>Updates the thumbnail's display settings.</summary>
        /// <param name="destination">Drawing region on destination window.</param>
        /// <param name="opacity">Opacity. 0 is transparent, 255 opaque.</param>
        /// <param name="visible">Visibility flag.</param>
        /// <param name="onlyClientArea">If true, only the client area of the window will be rendered. Otherwise, the borders will be be rendered as well.</param>
        public void Update(Rectangle destination, byte opacity, bool visible, bool onlyClientArea)
        {
            //Partial update
            NativeMethods.DwmThumbnailProperties prop = new NativeMethods.DwmThumbnailProperties();
            prop.dwFlags = NativeMethods.DwmThumbnailFlags.RectDestination |
                           NativeMethods.DwmThumbnailFlags.Opacity |
                           NativeMethods.DwmThumbnailFlags.Visible |
                           NativeMethods.DwmThumbnailFlags.SourceClientAreaOnly;

            prop.rcDestination = new Native.RECT(destination);
            prop.opacity = opacity;
            prop.fVisible = visible;
            prop.fSourceClientAreaOnly = onlyClientArea;

            if (NativeMethods.DwmUpdateThumbnailProperties(this, ref prop) != 0)
                throw new DwmCompositionException(Resources.ExceptionMessages.DwmThumbnailUpdateFailure);
        }
示例#4
0
        /// <summary>Updates the thumbnail's display settings.</summary>
        /// <param name="destination">Drawing region on destination window.</param>
        /// <param name="source">Origin region from source window.</param>
        /// <param name="opacity">Opacity. 0 is transparent, 255 opaque.</param>
        /// <param name="visible">Visibility flag.</param>
        /// <param name="onlyClientArea">If true, only the client area of the window will be rendered. Otherwise, the borders will be be rendered as well.</param>
        public void Update(Rectangle destination, Rectangle source, byte opacity, bool visible, bool onlyClientArea)
        {
            if (source.Width < 1 || source.Height < 1)
                throw new ArgumentException("Thumbnail source rectangle cannot have null or negative size.");

            //Full update
            NativeMethods.DwmThumbnailProperties prop = new NativeMethods.DwmThumbnailProperties();
            prop.dwFlags = NativeMethods.DwmThumbnailFlags.RectDestination |
                           NativeMethods.DwmThumbnailFlags.RectSource |
                           NativeMethods.DwmThumbnailFlags.Opacity |
                           NativeMethods.DwmThumbnailFlags.Visible |
                           NativeMethods.DwmThumbnailFlags.SourceClientAreaOnly;

            prop.rcDestination = new Native.RECT(destination);
            prop.rcSource = new Native.RECT(source);
            prop.opacity = opacity;
            prop.fVisible = visible;
            prop.fSourceClientAreaOnly = onlyClientArea;

            if (NativeMethods.DwmUpdateThumbnailProperties(this, ref prop) != 0)
                throw new DwmCompositionException(Resources.ExceptionMessages.DwmThumbnailUpdateFailure);
        }