10

在 WMP 中,我在任务栏缩略图上看到了按钮。如何在 C# 中为我的 winforms 应用程序制作它们?

在此处输入图像描述

4

2 回答 2

5

XAML

<Window.TaskbarItemInfo>
    <TaskbarItemInfo>
        <TaskbarItemInfo.ThumbButtonInfos>
            <ThumbButtonInfo ImageSource="/IconProgressDemo;component/Icon1.ico" Description="Play!" Click="ThumbButtonInfo_Click" />
            <ThumbButtonInfo ImageSource="/IconProgressDemo;component/Icon2.ico" Description="Stop!" Click="ThumbButtonInfo_Click" />
        </TaskbarItemInfo.ThumbButtonInfos>
    </TaskbarItemInfo>
</Window.TaskbarItemInfo>

C#

private void ThumbButtonInfo_Click(object sender, EventArgs e)
{
    MessageBox.Show((sender as System.Windows.Shell.ThumbButtonInfo).Description);
}

I haven't tried this hope this will be helpful.

and refer these links.

http://www.zayko.net/post/Adding-Buttons-to-Window-Thumbnail-in-WPF-4-for-Windows-7-(C).aspx

http://msdn.microsoft.com/en-us/windows7trainingcourse_win7taskbarmanaged_topic2.aspx

http://msdn.microsoft.com/en-us/magazine/dd942846.aspx

and there is Taskbar API available you can try with that.

于 2013-08-20T05:01:07.063 回答
5

WindowsAPICodePack包含一个名为的控件,ThumbnailToolBarButton您可以使用它来实现此功能。

您需要确保每个按钮都有图标(因为我不相信您可以在上面放置文本),然后创建新控件和添加相关事件处理程序应该是一件简单的事情。

这里采购。

于 2013-08-20T05:04:25.040 回答