views:

468

answers:

2

Hello,

I am currently using the Windows 7 API Code pack for an application I am coding in C#. Currently, I understand how to draw part of the Window region or a control into the thumbnail preview:

TaskbarManager.Instance.TabbedThumbnail.SetThumbnailClip((new WindowInteropHelper(this)).Handle, new System.Drawing.Rectangle((int)v.X, (int)v.Y, (int)pictureBox1.RenderSize.Width, (int)pictureBox1.RenderSize.Height));

However, I am wanting to draw a Bitmap image into the thumbnail. There is an method for it, but it is not documented very well. The method to set a bitmap i:

System.Drawing.Bitmap bmptest = new System.Drawing.Bitmap(ms);
tb.SetImage(bmptest)

That does work, but it still doesn't set the thumbnail preview of the (bmptest) bitmap.

I am wondering if there is anybody here who has an insight into the Windows 7 API code pack and if they could please point me into the right direction with how to set a bitmap image in the thumbnail preview.

Regards,

Daniel

A: 

I've never worked with the Windows 7 API code pack, but the Bitmap class has a GetThumbnailImage(...) method which may give you what you need.

MusiGenesis
A: 

Try creating a custom TabbedThumbnail first and the setting the image on the thumbnail...

Here is a example of how to create your own TabbedThumbnail

preview = new TabbedThumbnail(this, this, VisualTreeHelper.GetOffset(this));

Taken from this article!

rudigrobler