Setting a Bitmap in Windows 7 thumbnail preview

独自空忆成欢 提交于 2019-12-13 00:46:25

问题


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.


回答1:


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!




回答2:


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.



来源:https://stackoverflow.com/questions/1548229/setting-a-bitmap-in-windows-7-thumbnail-preview

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!