Exemple #1
0
        //Update the thumbnail with new positions
        private void UpdateThumb()
        {
            if (thumb != IntPtr.Zero) //That would be bad!
            {
                Win32Api.PSIZE size;
                Win32Api.DwmQueryThumbnailSourceSize(thumb, out size);                             //Get the source thumbnail size

                Win32Api.DWM_THUMBNAIL_PROPERTIES props = new Win32Api.DWM_THUMBNAIL_PROPERTIES(); //And it's properties

                //We want it visible!
                props.fVisible = true;
                props.dwFlags  = Win32Api.DWM_TNP_VISIBLE | Win32Api.DWM_TNP_RECTDESTINATION | Win32Api.DWM_TNP_OPACITY;
                props.opacity  = (byte)255;
                Win32Api.RECT rect = new Win32Api.RECT();

                //I'm not exactly sure why this is like this.
                //It may be best to leave it be.
                //Just...don't touch it
                int offset = 23;
                rect.Left   = preview.Left + groupPreview.Left + container.Panel2.Left + container.Left + tabControl.Left + 5;
                rect.Top    = preview.Top + groupPreview.Top + container.Panel2.Top + +container.Top + tabControl.Top + offset;
                rect.Right  = preview.Right + groupPreview.Left + container.Panel2.Left + container.Left + tabControl.Left + 4;
                rect.Bottom = preview.Bottom + groupPreview.Top + container.Panel2.Top + container.Top + tabControl.Top + offset - 1;

                props.rcDestination = rect;

                //Update the properties with the new dimensions
                Win32Api.DwmUpdateThumbnailProperties(thumb, ref props);
            }
        }
            public bool TryRead(Reader reader, SerializationContext context, out Win32Api.RECT rect)
            {
                var obj = Read(reader, null, context);

                if (obj == null)
                {
                    rect = new Win32Api.RECT();
                    return(false);
                }
                rect = (Win32Api.RECT)obj;
                return(true);
            }