ComponentFactory / Krypton

Krypton WinForms components for .NET
BSD 3-Clause "New" or "Revised" License
1.88k stars 687 forks source link

Get Ribbon Button by Name #74

Open DarthVader85PA opened 6 years ago

DarthVader85PA commented 6 years ago

First of all: Thanks for that great collection of winform elements. Now my question: Is it possible to get a ribbon button by name? How can I search in a collection for this? Thanks, Greetings from Germany! Danny

Smurf-IV commented 6 years ago

Just a guess, but maybe something along these lines: public KryptonRibbonTabCollection RibbonTabs { get; private set; } foreach over the RibbonTabs -> Ribbon foreach (KryptonRibbonGroup group in Ribbon.Groups)

etc.

DarthVader85PA commented 6 years ago

Hey Smurf-IV, thanks for your comment. This was my first idea but i cannot check the name of the button. My second idea was search for the Controls with the Find-Method. But in the controls-collection is no button control.

I programme in VB.NET: Me.Ribbon.Controls.Find()

I would like set a Button enable or disable. My Form with the Ribbon has a Interface-Method that I call from an another Form. My Method-Name: ChangeRibbonButtonStatus(ByVal Name As String, ByVal Status As Boolean). Now you know what I want with the Name of the Button. :D Perhaps anyone has a idea?!

Thanks for all, Danny