简体   繁体   English

C#VSTO Excel 2007 - 禁用隐藏/取消隐藏按钮

[英]C# VSTO Excel 2007 - disable hide/unhide button

I am working on a Excel VSTO 2007 application. 我正在开发Excel VSTO 2007应用程序。 I was wondering if there is a way I could disable the Hide and Unhide buttons present in Excel's View tab. 我想知道是否有一种方法可以禁用Excel的“ 视图”选项卡中的“ Hide和“ Unhide按钮。

www.i.stack.imgur.com/vLfW5.png

edit: I am looking for a way to do it programatically using c# Code . 编辑:我正在寻找一种使用c#Code以编程方式进行编写的方法。 The old vba might be useful. 旧的vba可能很有用。 I have searched a lot and couldn't find any particular solution. 我搜索了很多,找不到任何特定的解决方案。

I use something like the below to disable the sheet deletion button, perhaps there's something similar for what you want: 我使用类似下面的内容来禁用表单删除按钮,也许有类似的东西你想要的:

Microsoft.Office.Tools.Excel.Worksheet.Worksheet excelShtBase;
excelShtBase.Application.CommandBars["Ply"].Controls["&Delete"].Enabled = false;

I don't think you can disable the built-in controls in Excel 2007 and onwards, unless you create your own ribbon bar controls with Ribbon XML. 除非您使用Ribbon XML创建自己的功能区栏控件,否则我认为您无法在Excel 2007及更高版本中禁用内置控件。

There're lots of examples or tutorials on MSDN, and here's one for you ( Display and Hide Tabs, Groups, and Controls on the Microsoft Office Ribbon ). MSDN上有很多示例或教程,这里有一个适合您( Microsoft Office功能区上的显示和隐藏选项卡,组和控件 )。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM