How to programmatically add ribbon button on ribbon group

Add-in Express™ Support Service
That's what is more important than anything else

How to programmatically add ribbon button on ribbon group
 
Nevzat Hayri TAVUKÇU




Posts: 27
Joined: 2019-12-19
I have a button in ribbon group. I want to create a button next to it when I click the button. The code below didn't work. Doesn't add any

 
 private void AddedButton_OnClick(object sender, IRibbonControl control, bool pressed)
        {
            var rbFormEvent = new AddinExpress.MSO.ADXRibbonButton(this.components);
            this.rgFormEvents.Controls.Add(rbFormEvent);
            rbFormEvent.Caption = $"test123{DateTime.Now.Millisecond.ToString()}";
            rbFormEvent.Id = $"ID_{Guid.NewGuid().ToString()}";
            rbFormEvent.ImageTransparentColor = System.Drawing.Color.Transparent;
            rbFormEvent.Ribbons = ((AddinExpress.MSO.ADXRibbons)(((AddinExpress.MSO.ADXRibbons.msrOutlookMailRead | 
                                                                 AddinExpress.MSO.ADXRibbons.msrOutlookMailCompose)
                                                                 | AddinExpress.MSO.ADXRibbons.msrOutlookExplorer)));
        }
Posted 02 Apr, 2020 18:26:55 Top
Andrei Smolin


Add-in Express team


Posts: 17367
Joined: 2006-05-11
Hello Nevzat,

See section Creating Ribbon Controls at Run Time; see the PDF file in the folder {Add-in Express}\Docs on your development PC.

Regards from Belarus (GMT+3),

Andrei Smolin
Add-in Express Team Leader
Posted 03 Apr, 2020 01:24:04 Top