Skybound Rebar

RebarBand Constructor (RebarBandType)

Initializes a new instance of a RebarBand by specifying a band type.

[Visual Basic]
Overloads Public Sub New( _
   ByVal bandType As RebarBandType _
)
[C#]
public RebarBand(
   RebarBandType bandType
);

Parameters

bandType
The type of this rebar band.

Remarks

The newly created RebarBand has no default Text or Image assigned to it.

Exceptions

Exception Type Condition
InvalidEnumArgumentException The assigned value is not one of the RebarBandType values.

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 | RebarBand Constructor Overload List