欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

vsto 检测是否在编辑状态或者光标闪动

程序员文章站 2022-04-09 14:57:32
object m = Type.Missing; const int MENU_ITEM_TYPE = 1; const int NEW_MENU = 18; CommandBarControl oNewMenu = ExcelGlobals.Application.CommandBars["Wor ......

object m = type.missing;
const int menu_item_type = 1;
const int new_menu = 18;

commandbarcontrol onewmenu =
excelglobals.application.commandbars["worksheet menu bar"].findcontrol(
menu_item_type, //the type of item to look for
new_menu, //the item to look for
m, //the tag property (in this case missing)
m, //the visible property (in this case missing)
true); //we want to look for it recursively
//so the last argument should be true.

if (onewmenu != null)
{
if (!onewmenu.enabled)
{
messagebox.show("当前文档有光标在闪动,请取消光标闪动");
return;
}
}