如何在C#中显示文件的系统菜单

How to show system menu of a file in C#(如何在C#中显示文件的系统菜单)
本文介绍了如何在C#中显示文件的系统菜单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我需要在我的应用程序中显示文件的系统菜单.此菜单与图像相同.

I need to show system menu of a file in my application. This menu same as the image.

而且,我还想在这个菜单中添加一个我的菜单元素.

And, I also want to add a my menu element to this menu.

我该怎么办?

谢谢

推荐答案

您要查找的内容称为 shell 上下文菜单.要在您的应用程序中显示这样的菜单,您必须调用 Windows API.这一点都不容易,但幸运的是,其他人已经尝试了它.

What you're looking for is called a shell context menu. To display such a menu in your application, you'll have to call the Windows API. This is not at all easy, but fortunately for you some other people have taken a stab at it.

CodeProject 上的 C# 文件浏览器 有一个 shell 上下文菜单,在那篇文章中也有描述.

The C# File Browser on CodeProject has a shell context menu, which is also described in that article.

然后 Andreas Johansson 从该项目中提取 shell 上下文菜单代码并将其上传为一个单独的 ZIP 文件,您可以此处下载.

Then Andreas Johansson extracted the shell context menu code from that project and uploaded it as a separate ZIP file, which you can download here.

我不知道如何使用它,甚至不知道它是否有效.这留给读者作为练习.但是如果你深入研究代码,你可以从中学到很多东西.

I have no idea how to use it, or even if it works. That's left as an exercise for the reader. But there is a lot you can learn from this if you dig into the code.

这篇关于如何在C#中显示文件的系统菜单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

ActiveDirectory error 0x8000500c when traversing properties(遍历属性时 ActiveDirectory 错误 0x8000500c)
search by samaccountname with wildcards(使用通配符按 samaccountname 搜索)
Get the list of Groups for the given UserPrincipal(获取给定 UserPrincipal 的组列表)
Can you find an Active Directory User#39;s Primary Group in C#?(你能在 C# 中找到 Active Directory 用户的主要组吗?)
Query From LDAP for User Groups(从 LDAP 查询用户组)
How can I get DOMAINUSER from an AD DirectoryEntry?(如何从 AD DirectoryEntry 获取 DOMAINUSER?)