且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

添加到c#中的上下文菜单的问题

更新时间:2023-12-06 08:25:16

你应该开始学习有一个内置的注册表视窗。它控制应用程序和系统进程的整体行为,您可以根据自己的要求进行编辑。



您需要编辑 HKEY_CLASSES_ROOT \您的系统(或您的应用程序将在其上执行的系统)的目录\ Backbackground \shell 部分。进入这个位置后,按照以下步骤进行操作



You should start learning there is a Registry built right into the Windows. Which controls the overall behaviour of the applications and the system processes and you can edit them as per your requirements.

You need to edit the "HKEY_CLASSES_ROOT\Directory\Background\shell" section for your system (or the system your application would execute at). Once inside this location, follow the steps



  1. 在shell中创建一个新密钥;将其命名为您希望它显示在上下文菜单中。
  2. 在该键内,添加一个新键,将其命名为command。
  3. 编辑它,并为其提供应用程序位置的值,可执行文件的位置。





这是手动过程,要在C#中执行此操作,您必须使用Visual C#编辑注册表。请参阅最后一段中包含的MSDN RegistryKey类。它将为您提供有关可用于从应用程序编辑注册表的方法的信息。



有关详细信息,请转到这个博客 [ ^ ]并学习使用Visual C#在.NET中使用Registry,转到 MSDN [ ^ ]。



This is the manual process, to do this in the C#, you will have to edit the Registry using Visual C#. Refer to the MSDN RegistryKey Class I've included in the last paragraph. It would give you information about the methods that can be used to edit the Registry from your application.

For more on this, please go to, this blog[^] and to learn working with the Registry in .NET using Visual C#, go to MSDN[^].