/// <summary> /// Specifies that only a portion of the window's client area /// should be used in the window's thumbnail. /// </summary> /// <param name="hwnd">The window.</param> /// <param name="clipRect">The rectangle that specifies the clipped region.</param> private static void SetThumbnailClip(this Form form, Rectangle clipRect) { //Example: SetThumbnailClip(this, new Rectangle(button.Location, button.Size)); Rect rect = new Rect(clipRect.Left, clipRect.Top, clipRect.Right, clipRect.Bottom); HResult setThumbnailClipResult = TaskbarList.SetThumbnailClip(form.Handle, ref rect); setThumbnailClipResult.ThrowIf(); }