Thumbnail Toolbar for Windows 7 Taskbar Development

  
        

Previously we set a custom thumbnail for the application. In this article we will continue to develop in the thumbnail and add a Toolbar to it. When using Windows Media Player (WMP), the thumbnail toolbar appears when you place the mouse over the WMP icon, including the three function keys "Play", "Next" and "Previous", even if WMP Not the current active window. We can also select songs through this toolbar. Let's create a toolbar with the ability to switch pictures.


ThumbnailButton.ThumbnailToolbarButton Method

Create four function buttons via the ThumbnailToolbarButton(Icon icon, string tooltip) method before creating the toolbar: "Next Image", " Previous Image", "Last Image", "First Image" and add their own Click events (for example, buttonFirst_Click) to complete the image switching function, and then put these buttons into 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 += buttonPrevious_Click;
< BR> ThumbnailToolbarButton buttonNext = new ThumbnailToolbarButton (
Win7TaskbarDemo.PropertIEs.Resources.Next, "Next Image");
buttonPrevious.Enabled = true;
buttonNext.Click + = buttonNext_Click;

ThumbnailToolbarButton buttonLast = new ThumbnailToolbarButton(
Win7TaskbarDemo.PropertIEs.Resource s.Last, "Last Image");
buttonPrevious.Enabled = true;
buttonLast.Click += buttonLast_Click;

ThumbnailToolbarManager.AddButtons Method

AddButtons Method Reference: Br>

public void AddButtons(IntPtr windowHandle, params ThumbnailToolbarButton[] buttons);
public void AddButtons(UIElement control, params ThumbnailToolbarButton[] buttons);

Place four buttons in the toolbar Note the order of the buttons:

TaskbarManager.Instance.ThumbnailToolbars.AddButtons(
new WindowInteropHelper(Application.Current.MainWindow).Handle,
buttonFirst, buttonPrevious, buttonNext, buttonLast); Br>

Effects Demo

As shown in the following figure, the function of the application itself is: "After selecting the picture in the ListBox, the enlarged picture above the ListBox is updated synchronously. If you place the mouse over the taskbar icon, you can see the thumbnail toolbar we just created. You can switch the image in the ListBox with the four function buttons inside to achieve the same function as the program.



Copyright © Windows knowledge All Rights Reserved