예제 #1
0
        /// <summary>Selects a portion of a window's client area to display as that window's thumbnail in the taskbar.</summary>
        /// <param name="parent">The window represented in the taskbar.</param>
        /// <param name="windowClipRect">
        /// A <see cref="Rectangle"/> that specifies a selection within the window's client area, relative to the upper-left corner of that client area. To clear
        /// a clip that is already in place and return to the default display of the thumbnail, set this parameter to NULL.
        /// </param>
        public static void SetThumbnailClip(IWin32Window parent, Rectangle windowClipRect)
        {
            Validate7OrLater();
            if (parent == null)
            {
                throw new ArgumentNullException(nameof(parent));
            }
            RECT cr = windowClipRect;

            taskbar4?.SetThumbnailClip(parent.Handle, ref cr);
        }
예제 #2
0
 public static void SetThumbnailClip(IntPtr hwnd, NativeRect?rect)
 {
     if (IsInitialized)
     {
         if (rect.HasValue)
         {
             IntPtr rectPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(rect));
             try
             {
                 Marshal.StructureToPtr(rect, rectPtr, true);
                 taskbar.SetThumbnailClip(hwnd, rectPtr);
             }
             finally
             {
                 Marshal.FreeCoTaskMem(rectPtr);
             }
         }
         else
         {
             taskbar.SetThumbnailClip(hwnd, IntPtr.Zero);
         }
     }
 }