How to add a button to a pre-existing tab on ribbon (C#)?

前端 未结 4 1892
感情败类
感情败类 2021-02-20 04:22

I\'ve successfully created a new tab and put it next to the pre-existing ones. Then I realized that I\'ll only have one button on it, so it makes more sense (for now) to put it

4条回答
  •  一整个雨季
    2021-02-20 05:03

    Edited. Sorry, gave a dnn link. You want office and you want c#.

    Here's a StackOverflow answer in VBA... How to get Ribbon custom Tabs IDs?

    AccessibleChildren _
                Lib "oleacc.dll" _
                    (ByVal paccContainer As Object, _
                     ByVal iChildStart As Long, _
                     ByVal cChildren As Long, _
                           rgvarChildren As Variant, _
                           pcObtained As Long) _
                As Long
    

    Which in C# translates to

    [Lib "oleacc.dll"]
    Long AccessibleChildren(object paccContainer, 
                            long iChildStart, 
                            long cChildren, 
                            object rgvarChildren, 
                            long pcObtained)...
    

    I never tried it, so not sure it works.

    From all other documentation, it seems you simply get the ribbon object, and in it iterate (with foreach) through all the children

提交回复
热议问题