Hi,
The example is quite clear.
Document doc = this.ActiveUIDocument.Document;
adwin.RibbonControl ribbon = adwin.ComponentManager.Ribbon;
Is above the issue?
doc call can be removed, this isn't used in the sample
for retrieving the ribbon itself, see below for the full call:
Autodesk.Windows.RibbonControl ribbon = Autodesk.Windows.ComponentManager.Ribbon;
1. Get the Ribbon itself, see above.
2. Loop all Tabs until the one is found that you use, see foreach loop for ribbon.Tabs
3. If Tab found, loop all Panels until the panel is found you created, see foreach loop on my_tab.Panels
4. If panel is found loop all items (buttons) on the panel, by inspecting it's source panel.
and again see loop: my_panel.Source.Items
5. If you're button is found then change it's image, text etc...
Now If you don't know on which panel the button is, then evaluate all panels of step 3. and call step 4 for each panel and list all items found. (panel.Source.Items <= loop all items and list their id's + Title.
See the Ribbon sample in the Revit API SDK's (About the Revit SDK ) for complete commands.