Skybound Rebar

RebarBand.Buttons Property

Gets a collection containing the buttons in the band.

[Visual Basic]
Public ReadOnly Property Buttons As RebarButtonCollection
[C#]
public RebarBand.RebarButtonCollection Buttons {get;}

Property Value

A RebarBand.RebarButtonCollection that contains all the buttons in the RebarBand.

Example

The following example initializes two bands and adds them to a rebar control. The first band is a MenuBar band with two menu buttons. The second band is a ToolBar band with two push buttons.

private void InitializeRebarBands(Rebar rebar)
{
    // create a new menu bar band:
    RebarBand menuBand = new RebarBand(RebarBandType.MenuBar);
    // turn off size grip for menu:
    menuBand.HasSizeGrip = false;
    // set height of menu at 22:
    menuBand.MinimumSize = new Size(0, 22);
    // specify the width as the fulle width of the rebar to force the next band added
    // to be added below:
    menuBand.SpecifiedWidth = rebar.Width;
    
    menuBand.Buttons.AddRange(new RebarButton[] {
        new RebarButton("btnFile", "&File", null, true, RebarButtonType.Menu),
        new RebarButton("btnHelp", "&Help", null, true, RebarButtonType.Menu)
        });
    
    // create a tool bar band:
    RebarBand toolsBand = new RebarBand(RebarBandType.ToolBar, "Tools", null);
    // set height of the buttons at 32:
    toolsBand.MinimumSize = new Size(0, 32);
    // text will be aligned below images:
    toolsBand.TextAlign = RebarTextAlign.Beside;
    
    toolsBand.Buttons.AddRange(new RebarButton[] {
        new RebarButton("btnNew", "New", null, true, RebarButtonType.Push),
        new RebarButton("btnSave", "Save", null, true, RebarButtonType.Push)
        });
    
    // force text to be visible because these button have no Image assigned
    toolsBand.Buttons[0].TextVisible = true;
    toolsBand.Buttons[1].TextVisible = true;
    
    // add bands to rebar
    rebar.Bands.Add(menuBand);
    rebar.Bands.Add(toolsBand);
}
            

See Also

RebarBand Class | Skybound.Rebar Namespace