VBA 新增簡單選單(有分割線)

2021-06-05 12:51:16 字數 1159 閱讀 7228

thisworkbook裡的**:

private sub workbook_open()

call addmenu

end sub

sub addmenu()  '選單

dim popup(1)

dim button(5) as commandbarcontrol

set button(1) = popup(0).controls.add(type:=msocontrolbutton, temporary:=true)

button(1).caption = "選單一"

button(1).onaction = ""

set button(2) = popup(0).controls.add(type:=msocontrolbutton, temporary:=true)

button(2).caption = "選單二"

button(2).onaction = ""

button(2).begingroup = true

set button(3) = popup(0).controls.add(type:=msocontrolbutton, temporary:=true)

button(3).caption = "選單三"

button(3).onaction = ""

button(3).begingroup = true

set button(4) = popup(0).controls.add(type:=msocontrolbutton, temporary:=true)

button(4).caption = "選單四"

button(4).onaction = ""

button(4).begingroup = true

set button(5) = popup(0).controls.add(type:=msocontrolbutton, temporary:=true)

button(5).caption = "選單五"

button(5).onaction = ""

button(5).begingroup = true

end sub

新增分割線

importandroid.content.context importandroid.content.res.typedarray importandroid.graphics.canvas importandroid.graphics.rect importandroid.graphics.dr...

給TextView新增行分割線

思路 通過在textview ondraw的方法裡把行分割線畫出來 自定義兩個屬性 name linedividertextview name line divider format reference name line divider height format dimension declar...

為RecyclerView新增分割線

由於recyclerview並沒有支援divider這樣的屬性,所以就需要我們自己去實現。這裡主要實現第二種 建立類繼承及recyclerview.itemdecoration public class myitemdecoration extends recyclerview.itemdecora...