Esempio n. 1
0
        private void UpdateThumb()
        {
            if (Thumb != IntPtr.Zero)
            {
                DwmQueryThumbnailSourceSize(Thumb, out PSIZE size);

                DWM_THUMBNAIL_PROPERTIES props = new DWM_THUMBNAIL_PROPERTIES
                {
                    fVisible = true,
                    dwFlags  = DWM_TNP_VISIBLE | DWM_TNP_RECTDESTINATION | DWM_TNP_OPACITY,
                    //opacity = (byte)opacity.Value,
                    opacity       = 255,
                    rcDestination = new Rect(ThumbnailControl.Left, ThumbnailControl.Top, ThumbnailControl.Right, ThumbnailControl.Bottom)
                };

                if (size.x < ThumbnailControl.Width)
                {
                    props.rcDestination.Right = props.rcDestination.Left + size.x;
                }

                if (size.y < ThumbnailControl.Height)
                {
                    props.rcDestination.Bottom = props.rcDestination.Top + size.y;
                }

                DwmUpdateThumbnailProperties(Thumb, ref props);
            }
        }
Esempio n. 2
0
 static extern int DwmUpdateThumbnailProperties(IntPtr hThumb, ref DWM_THUMBNAIL_PROPERTIES props);