开发者

Setting a Bitmap in Windows 7 thumbnail preview

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.


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!


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜