国产成人精品久久免费动漫-国产成人精品天堂-国产成人精品区在线观看-国产成人精品日本-a级毛片无码免费真人-a级毛片毛片免费观看久潮喷

您的位置:首頁技術(shù)文章
文章詳情頁

Windows 7 任務(wù)欄開發(fā)之縮略圖預(yù)覽(Thumbnail)

瀏覽:6日期:2023-05-31 15:12:22

上一篇我們對任務(wù)欄進(jìn)度條的開發(fā)有了相應(yīng)的了解,本篇將對縮略圖預(yù)覽功能進(jìn)行研究。提起縮略圖預(yù)覽相信使用過Windows 7 的朋友一定不會陌生,它可以說是Windows 7 的一大亮點(diǎn)。不論運(yùn)行的程序是否處于活動狀態(tài),只要將鼠標(biāo)放在任務(wù)欄圖標(biāo)上便會出現(xiàn)當(dāng)前程序的預(yù)覽效果。如下圖所示我們可以快速的在IE 縮略圖中找到想看的網(wǎng)頁。當(dāng)然在Windows API 中也提供了許多開發(fā)縮略圖的工具,下面我們來看看如何使用它們。

TabbedThumbnail.TabbedThumbnail 方法

在默認(rèn)情況下Windows 7 會顯示應(yīng)用程序界面(如下圖),如果想替換或增加新的縮略圖,首先應(yīng)通過TabbedThumbnail 類的TabbedThumbnail 方法創(chuàng)建一個新的縮略圖(Thumbnail)。

在TabbedThumbnail 類中,有三個TabbedThumbnail 方法可以創(chuàng)建縮略圖:

//設(shè)定父窗口和子窗口/控件 public TabbedThumbnail(IntPtr parentWindowHandle, IntPtr windowHandle) { if (parentWindowHandle == IntPtr.Zero) throw new ArgumentException('Parent window handle cannot be zero.', 'parentWindowHandle'); if (windowHandle == IntPtr.Zero) throw new ArgumentException('Child control's window handle cannot be zero.', 'windowHandle'); WindowHandle = windowHandle; ParentWindowHandle = parentWindowHandle; }  //設(shè)定父窗口和子控件 public TabbedThumbnail(IntPtr parentWindowHandle, Control control) { if (parentWindowHandle == IntPtr.Zero) throw new ArgumentException('Parent window handle cannot be zero.', 'parentWindowHandle'); if (control == null) throw new ArgumentNullException('control'); WindowHandle = control.Handle; ParentWindowHandle = parentWindowHandle; }  //設(shè)定父窗口或WPF子控件,以及兩者的偏移量 public TabbedThumbnail(Window parentWindow, UIElement windowsControl, Vector peekOffset) { if (windowsControl == null) throw new ArgumentNullException('control'); if (parentWindow == null) throw new ArgumentNullException('parentWindow'); WindowHandle = IntPtr.Zero; WindowsControl = windowsControl; WindowsControlParentWindow = parentWindow; ParentWindowHandle = (new WindowInteropHelper(parentWindow)).Handle; PeekOffset = peekOffset; }

TabbedThumbnail.AddThumbnailPrevIEw 方法

通過AddThumbnailPreview 方法將TabbedThumbnail 添加到任務(wù)欄縮略圖中:

public void AddThumbnailPreview(TabbedThumbnail preview){… …}

TabbedThumbnailManager.SetActiveTab 方法

通過SetActiveTab 方法將指定的縮略圖、窗口句柄、Form控件、WPF控件設(shè)置為活動狀態(tài)。例如,在IE 中我們打開了多個網(wǎng)頁標(biāo)簽,那么SetActiveTab 可以將其中一個標(biāo)簽設(shè)為當(dāng)前瀏覽頁。

public void SetActiveTab(TabbedThumbnail preview){… …} public void SetActiveTab(IntPtr windowHandle){… …} public void SetActiveTab(Control control){… …} public void SetActiveTab(UIElement WindowsControl){… …}

TabbedThumbnailManager.GetThumbnailPreview 方法

通過GetThumbnailPreview 方法獲取指定的窗口句柄、Form控件、WPF控件的縮略圖(TabbedThumbnail):

public TabbedThumbnail GetThumbnailPreview(IntPtr windowHandle){… …} public TabbedThumbnail GetThumbnailPreview(Control control){… …} public TabbedThumbnail GetThumbnailPreview(UIElement windowsControl){… …}

TabbedThumbnailManager.RemoveThumbnailPreview 方法

通過RemoveThumbnailPreview 方法將指定的縮略圖、窗口句柄、Form控件、WPF控件從任務(wù)欄縮略圖中刪除:

public void RemoveThumbnailPreview(TabbedThumbnail preview){… …} public void RemoveThumbnailPreview(IntPtr windowHandle){… …} public void RemoveThumbnailPreview(Control control){… …} public void RemoveThumbnailPreview(UIElement windowsControl){… …}

TabbedThumbnailManager.IsThumbnailPrevIEwAdded 方法

通過IsThumbnailPreviewAdded 方法判斷的縮略圖、窗口句柄、Form控件、WPF控件是否已添加,并返回Bool 值:

public bool IsThumbnailPreviewAdded(TabbedThumbnail preview){… …} public bool IsThumbnailPreviewAdded(IntPtr windowHandle){… …} public bool IsThumbnailPreviewAdded(Control control){… …} public bool IsThumbnailPreviewAdded(UIElement control){… …}

TabbedThumbnailManager.SetTabOrder 方法

通過SetTabOrder 方法調(diào)換兩個TabbedThumbnail 前后位置,注意第一個TabbedThumbnail 將調(diào)換到第二個TabbedThumbnail 的前面。

public void SetTabOrder(TabbedThumbnail previewToChange, TabbedThumbnail insertBeforePreview){… …}

效果演示

通過以上方法就能夠隨心所欲的設(shè)定縮略圖了,下面就將上面示意圖中的縮略圖改為Windows Logo 圖標(biāo),其中ui 即為XAML 代碼中控件的名稱(x:Name):

TabbedThumbnail newPreview = new TabbedThumbnail(Application.Current.MainWindow, ui, peekOffect); TaskbarManager.Instance.TabbedThumbnail.AddThumbnailPreview(newPreview); TaskbarManager.Instance.TabbedThumbnail.SetActiveTab(newPreview);

點(diǎn)擊“Set this image as thumbnail 前后對比,縮略圖變?yōu)榱?lt;Image> 控件:

修改前 

修改后

點(diǎn)擊“Add another thumbnail 后,可將<Button> 控件加入縮略圖中:

點(diǎn)擊 “Change thumbnail order 調(diào)換縮略圖前后位置:

另外,還可以通過TabbedThumbnail.Tooltip 屬性為縮略圖添加提示信息。當(dāng)鼠標(biāo)置于縮略圖上方時(shí),將會有相應(yīng)的ToolTip 顯示:

newPrevIEw.Tooltip = 'Welcome to Windows 7';

出處:http://www.cnblogs.com/gnielee/

標(biāo)簽: Windows系統(tǒng)
相關(guān)文章:
主站蜘蛛池模板: 亚洲成 人a影院青久在线观看 | 国产精品一区二区四区 | 久草成人在线视频 | 91精品国产91久久久久青草 | 亚洲精品国产综合久久一线 | 美国毛片免费观看 | 精品久久久久久久久久久久久久久 | 欧美一级毛片欧美一级 | 成人午夜视频一区二区国语 | 女人十八一级毛片 | 国产一区二区精品久久91 | 夜色爽爽 | 天堂8资源在线官网资源 | 香蕉久久夜色精品国产 | 在线观看人成午夜影片 | 欧美日韩在线观看一区 | 免费亚洲黄色 | 偷偷久久 | 中文字幕在线乱码不卡区区 | 免费一级欧美片片线观看 | 国产三级在线视频观看 | 国产一级一级 | 欧美一级黄色毛片 | 国产精品亚洲专一区二区三区 | 欧美在线视频 一区二区 | 久草热久草视频 | 亚洲精品一区二区四季 | 成人做爰网站免费看 | 精品老司机在线视频香蕉 | 久久久久久久99精品免费观看 | 91久久综合九色综合欧美98 | 欧洲成人免费视频 | 免费91最新地址永久入口 | 亚洲国产精品日韩在线 | 一区二区影视 | 清纯偷拍精品视频在线观看 | 制服丝袜在线视频香蕉 | 一级做a爰片性色毛片视频图片 | 亚洲视频在线观看 | 亚洲一区二区三区不卡在线播放 | 中国的毛片|