In the previous article, we appliedProgramWe have set custom thumbnails. In this article, we will continue to develop the thumbnails and add the toolbar to them ). When you use Windows Media Player (WMP), place the cursor over the WMP icon and the thumbnail toolbar appears, this includes three function keys: "play", "Next", and "previous". You can select a song through the toolbar even if WMP is not in the current activity window. Next we will create a toolbar with the function of switching images.
Thumbnailbutton. thumbnailtoolbarbutton Method
Before creating a toolbar, use the thumbnailtoolbarbutton (icon, string tooltip) method to create four function buttons: "Next image", "previous image", and "last image ", "First image" and add their respective click events (for example, buttonfirst_click) for them to complete the image switching function, and then place these buttons in the toolbar.
Thumbnailtoolbarbutton Buttonfirst = New Thumbnailtoolbarbutton (
Win7taskbardemo. properties.Resources . First, "First image" ); Buttonfirst. Enabled = True ; Buttonfirst. Click + = buttonfirst_click; Thumbnailtoolbarbutton Buttonprevious = New Thumbnailtoolbarbutton (
Win7taskbardemo. properties. Resources . Previous, "Previous image" ); Buttonprevious. Enabled = True ; Buttonprevious. Click + = buttonprevius_click; Thumbnailtoolbarbutton Buttonnext = New Thumbnailtoolbarbutton (
Win7taskbardemo. properties. Resources . Next, "Next image" ); Buttonprevious. Enabled = True ; Buttonnext. Click + = buttonnext_click; Thumbnailtoolbarbutton Buttonlast = New Thumbnailtoolbarbutton (
Win7taskbardemo. properties. Resources . Last,"Last image" ); Buttonprevious. Enabled = True ; Buttonlast. Click + = buttonlast_click;
Thumbnailtoolbarmanager. addbuttons Method
For the addbuttons method, refer:
Public voidAddbuttons (IntptrWindowhandle,ParamsThumbnailtoolbarbutton[] Buttons );Public voidAddbuttons (UielementControl,ParamsThumbnailtoolbarbutton[] Buttons );
Put the four buttons in the toolbar. Note the order of the buttons:
Taskbarmanager. Instance. thumbnailtoolbars. addbuttons (NewWindowinterophelper(Application. Current. mainwindow). Handle, buttonfirst, buttonprevious, buttonnext, buttonlast );
Effect demonstration
As shown in, the function of the application itself is: "After you select an image in The ListBox, synchronously update the enlarged image above the ListBox ." If you place the cursor over the taskbar icon, you can see the thumbnail toolbar we just created. You can switch the image in the ListBox through the four buttons to achieve the same functional effect as the program.
References
1. Windows API code pack for. NET Framework
Http://code.msdn.microsoft.com/WindowsAPICodePack
2. thumbnail toolbars
Http://msdn.microsoft.com/en-us/library/dd378460 (vs.85). aspx # thumbbars
3. thumbnail preview for Windows 7 taskbar Development (thumbnail)
Http://www.cnblogs.com/gnielee/archive/2010/03/08/windows7-taskbar-thumbnail-preview.html
Source code Download
Contains all previous instances: