Click here to Skip to main content
15,885,366 members
Articles / Mobile Apps / Windows Phone 7

Window 7: Setting Custom Thumbnail Clip

Rate me:
Please Sign up or sign in to vote.
5.00/5 (3 votes)
24 Sep 2010CPOL 13.8K   5  
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;
}

This article was originally posted at http://codereflect.com?p=1171

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Technical Lead
India India
Software Developer

Comments and Discussions

 
-- There are no messages in this forum --