将项目添加到任务栏应用程序菜单 [英] Adding items to the taskbar application menu

查看:67
本文介绍了将项目添加到任务栏应用程序菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个申请.我想通过C#将我的特定项目添加到右键单击应用程序的任务栏菜单中.我要同时添加永久项目和临时项目.

如果我没有让你理解,这就是我正在谈论的菜单:

解决方案

此功能称为JumpList,适用于Windows7.它是Microsoft API的一部分.此处.

为了能够处理Windows窗体中的Jumplist类,您必须包括这些DLL( Microsoft.WindowsAPICodePack.dll Microsoft.WindowsAPICodePack.Shell.dll ).您可以从此CodeProject中获取它们项目,或者您可以从 WindowsAPICodePack 下载开源库,其中包含了以下源代码:可用于访问Windows 7和Windows Vista功能.您将需要在代码顶部添加两个用法:

 使用Microsoft.WindowsAPICodePack.Taskbar;使用Microsoft.WindowsAPICodePack.Shell; 

任何 Jumplist 均由类别组成,每个类别都有自己的 Jumptask .到目前为止,WindowsAPICodePack支持两种类型的 Jumptask . JumplistLink JumplistSeperator . Jumptask 表示要由用户执行的动作,例如打开应用程序的新实例或启动另一个程序.这些 Jumptask s被归类为称为 JumplistCustomCategories 的类别.

I have an application. I would like to add my particular items to the right-click application's taskbar menu via C#. I want to add both permanent items and temporary items.

If I haven't made you to understand, this is the menu I am talking about:

解决方案

This feature is called a JumpList and is for Windows 7. It is part of the Microsoft API. How to use this with C# has been documented thoroughly here and here.

In order to be able to deal with Jumplist classes in Windows Forms, you'd have to include these DLLs (Microsoft.WindowsAPICodePack.dll and Microsoft.WindowsAPICodePack.Shell.dll) in your project. You can get them from this CodeProject project or you can download the Open source library from WindowsAPICodePack which includes the source code that can be used to access Windows 7 and Windows Vista features. You will need to add two usings at the top of your code:

using Microsoft.WindowsAPICodePack.Taskbar;
using Microsoft.WindowsAPICodePack.Shell;

Any Jumplist consists of categories and each category has its own Jumptasks. There are two types of Jumptasks supported till now by WindowsAPICodePack; the JumplistLink and JumplistSeperator. A Jumptask represents an action to be performed by the user like openning a new instance of the application or launching another program. These Jumptasks are grouped in categories called JumplistCustomCategories.

这篇关于将项目添加到任务栏应用程序菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆