Ankh選單刪除

2021-09-05 18:49:31 字數 3848 閱讀 5977

1:  

imports system

2:  

imports envdte

3:  

imports system.diagnostics

4:  

' comment the following line if you're running the macro in visual studio .net 2003.

5:  

imports microsoft.visualstudio.commandbars

6:  

imports microsoft.office.core

7:
8:  

public

module removeankhmenus

9:  

public

sub removeankhmenus()

10:          deleteankhcommandcontrols()
11:          deleteankhcommands()
12:  

endsub

13:
14:  

private

sub deleteankhcommandcontrols()

15:  

foreach bar as commandbar in

ctype(dte.commandbars, commandbars)

16:  

' debug.writeline(string.format("processing : ", getpath(bar)))

17:
18:              recursecommandcontrols(bar.controls)
19:  

next

20:  

endsub

21:
22:  

private

sub recursecommandcontrols(byval controls as commandbarcontrols)

23:  

foreach control as commandbarcontrol in controls

24:  

' debug.writeline(string.format("processing : ", getpath(control)))

25:
26:  

' recurse childs.

27:  

if control.accchildcount > 0 then

28:  

if control.type = msocontroltype.msocontrolpopup then

29:                      recursecommandcontrols(ctype(control, commandbarpopup).controls)
30:  

endif

31:  

endif

32:
33:  

' delete the control if it is related to ankhsvn.

34:              deleteankhcommandcontrol(control)
35:  

next

36:  

endsub

37:
38:  

private

sub deleteankhcommandcontrol(byval control as commandbarcontrol)

39:  

' delete control if it is related to ankhsvn.

40:  

if control.caption.startswith("ankh") then

41:              debug.writeline(string.format("deleting control: ", getpath(control)))
42:              control.delete()
43:  

endif

44:  

endsub

45:
46:  

private

sub deleteankhcommands()

47:  

' delete all commands related to ankhsvn.

48:  

foreach command as command in dte.commands

49:  

if command.name <> nothing

then

50:  

if command.name.startswith("ankh") then

51:                      debug.writeline(string.format("deleting command: ", command.name))
52:                      command.delete()
53:  

endif

54:  

endif

55:  

next

56:  

endsub

57:
58:  

private

function getpath(byval control as

object) as

string

59:  

iftypeof (control) is commandbarcontrol then

60:  

dim cbc as commandbarcontrol

61:              cbc = ctype(control, commandbarcontrol)
62:
63:  

return getpath(cbc.parent) + "->" + cbc.caption

64:  

endif

65:
66:  

iftypeof (control) is commandbar then

67:  

dim cb as commandbar

68:              cb = ctype(control, commandbar)
69:
70:  

return getpath(cb.parent) + "->" + cb.name

71:  

endif

72:
73:  

return

"dte"

74:  

endfunction

75:  

end module

還乙個解決辦法就是匯出vs ide的設定,然後重置ide。但這會丟失所有的自定義設定。如果自定義不多,完全可以使用這個方法。 只好再次回到visual svn了,唉...

原始碼控制,仍然推薦使用svn。

用gtk寫的動態新增刪除選單 選單項 子選單的介面

介面 menu.h menu.h dynamic menu facility.ifndef menu h define menu h struct path nc 獲得選單項的名字 gchar g menu item get label gtkwidget menu item 獲得path的各個名字...

刪除右鍵選單中的Git

安裝完git之後,會發現在系統 此指windows 的右鍵選單中會多出git的三個選項 git init here git gui 和git bash。如果你用不著上述三個命令,而且也跟我一樣覺著很長的右鍵選單覺著不爽,那你可以按照以下的方法移除右鍵選單的git命令 1 找到你git的安裝路徑,如 ...

刪除右鍵選單中的Git

安裝完git之後,會發現在系統 此指windows 的右鍵選單中會多出git的三個選項 git init here git gui 和git bash。如果你用不著上述三個命令,而且也跟我一樣覺著很長的右鍵選單覺著不爽,那你可以按照以下的方法移除右鍵選單的git命令 1 找到你git的安裝路徑,如 ...