Skybound Rebar

ToggleMenuEventArgs Class

Provides data for the ToggleMenuEventHandler event.

For a list of all members of this type, see ToggleMenuEventArgs Members.

System.Object
   System.EventArgs
      Skybound.Rebar.ToggleMenuEventArgs

[Visual Basic]
Public Class ToggleMenuEventArgs
    Inherits EventArgs
[C#]
public class ToggleMenuEventArgs : EventArgs

Thread Safety

Public static (Shared in Visual Basic) members of this type are safe for multithreaded operations. Instance members are not guaranteed to be thread-safe.

Remarks

The ToggleMenuEventArgs class provides the menu that will be displayed when the the control is right-clicked. The menu in the Menu property contains a menu item for each rebar band whose CanToggle property is true. You may customize this menu by adding or removing items, or by changing the existing default items.

When Rebar.LockBandsText is not an empty string (""), two additional items are added to the bottom of the menu: a separator bar, and an item that can lock or unlock all the bands on the Rebar.

You can prevent the toggle menu from being displayed entirely by setting the Menu property to a null reference (Nothing in Visual Basic).

Example

This example adds 3 items to the bottom of the context menu that are used to maximize, minimize or restore the band that was clicked.

/// <summary>
/// Handles the ToggleMenuPopup event for a Rebar control.
/// </summary>
private void rebar_ToggleMenuPopup(object sender, Skybound.Rebar.ToggleMenuEventArgs e)
{
    e.Menu.MenuItems.Add("-");
    e.Menu.MenuItems.Add("Maximize band", new EventHandler(OnMaximizeClick));
    e.Menu.MenuItems.Add("Minimize band", new EventHandler(OnMinimizeClick));
    e.Menu.MenuItems.Add("Restore band", new EventHandler(OnRestoreClick));
    ClickedBand  = rebar.GetBandAtPoint(new Point(e.X, e.Y));
}

// Stores the band that exists at the point where the toggle menu is displayed.
RebarBand ClickedBand;

// Maximizes the band that was clicked.
private void OnMaximizeClick(object sender, EventArgs e)
{
    if (ClickedBand != null)
    {
        ClickedBand.Maximize();
    }
}

// Minimizes the band that was clicked.
private void OnMinimizeClick(object sender, EventArgs e)
{
    if (ClickedBand != null)
    {
        ClickedBand.Minimize();
    }
}

// Restores the band that was clicked.
private void OnRestoreClick(object sender, EventArgs e)
{
    if (ClickedBand != null)
    {
        ClickedBand.Restore();
    }
}
            

Requirements

Namespace: Skybound.Rebar

Assembly: Skybound.Rebar (in Skybound.Rebar.dll)

See Also

ToggleMenuEventArgs Members | Skybound.Rebar Namespace