Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles
(untagged)

Window 7: Setting Custom Thumbnail Clip

0.00/5 (No votes)
24 Sep 2010 1  
Window 7: Setting custom Thumbnail clip

In the previous posts, I covered the basics of setting progress overlay and adding buttons to the thumbnail flyout area.

All thumbnail previews display the real-time content of the window client area. Suppose we're watching movies, we can see it through thumbnails. If we’re listening to music, we can see the album artwork on hovering the thumbnail. But we can customize the window area to display in the thumbnail area.

Let’s take the previous example. By default, Windows will display the entire window area.

image

Let’s take an example of clipping the preview to the scrollbar.

image

What we can do is quite simple and straightforward. Just set the offset from the client area to be clipped. See the example below. Setting a NULL area will reset the thumbnail preview to default.

C++
BEGIN_MESSAGE_MAP(CTaskBarSampleDlg, CDialogEx)
	ON_REGISTERED_MESSAGE( g_uTBBC, CTaskBarSampleDlg::OnCreateThumbToolBar )
END_MESSAGE_MAP()

LRESULT CTaskBarSampleDlg::OnCreateThumbToolBar( WPARAM, LPARAM )
{
	// Initialize the pointer. You can also do this in the constructor.
	// Remember to release after use
	if( NULL == m_pTaskBarlist )
	{
		CoCreateInstance( CLSID_TaskbarList, NULL, CLSCTX_ALL,
				IID_ITaskbarList3, (void**)&m_pTaskBarlist);
	}
	return 0;
}

void CTaskBarSampleDlg::OnBnClickedButton2()
{
	static bool bClip = true;
	if( bClip )
	{
		CRect rect;
		m_Progress.GetWindowRect( rect );
		ScreenToClient( rect );
		m_pTaskBarlist->SetThumbnailClip( m_hWnd,rect );

	}
	else
		m_pTaskBarlist->SetThumbnailClip
			( m_hWnd, NULL ); // NULL will reset to default

	bClip = !bClip;
}

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here