Spread for ASP.NET 13 Product Documentation
FarPoint.Web.Spread Assembly / FarPoint.Web.Spread Namespace / SheetView Class / ContextMenuStyle Property
Example


In This Topic
    ContextMenuStyle Property (SheetView)
    In This Topic
    Gets or sets the context menu style.
    Syntax
    'Declaration
     
    Public Property ContextMenuStyle As ContextMenuStyle
    'Usage
     
    Dim instance As SheetView
    Dim value As ContextMenuStyle
     
    instance.ContextMenuStyle = value
     
    value = instance.ContextMenuStyle
    public ContextMenuStyle ContextMenuStyle {get; set;}

    Property Value

    The context menu style.
    Example
    This example creates a menu.
    FarPoint.Web.Spread.ContextMenuStyle stylem = new FarPoint.Web.Spread.ContextMenuStyle();
    stylem.BackColor = Color.Aqua;
    stylem.ItemBackColor = Color.Beige;
    FpSpread1.ActiveSheetView.ContextMenuStyle = stylem;
    FpSpread1.EnableContextMenu = true;
    FarPoint.Web.Spread.ContextMenu rowHeaderContextMenu = new FarPoint.Web.Spread.ContextMenu();
    rowHeaderContextMenu.Type = FarPoint.Web.Spread.ContextMenuType.RowHeader;
    FarPoint.Web.Spread.MenuItem rowHeaderItem = new FarPoint.Web.Spread.MenuItem("RowHeader item 1");
    rowHeaderItem.ChildItems.Add(new FarPoint.Web.Spread.MenuItem("Child item 1"));
    rowHeaderItem.ChildItems.Add(new FarPoint.Web.Spread.MenuItem("Child item 2"));
    rowHeaderItem.ChildItems[1].Visible = true;
    rowHeaderContextMenu.Items.Add(rowHeaderItem);
    FpSpread1.ContextMenus.Add(rowHeaderContextMenu); 
    Dim stylem As New FarPoint.Web.Spread.ContextMenuStyle()
    stylem.BackColor = Drawing.Color.Aqua
    stylem.ItemBackColor = Drawing.Color.Beige
    FpSpread1.ActiveSheetView.ContextMenuStyle = stylem
    FpSpread1.EnableContextMenu = True
    'If the RowHeader context menu has not been added, add it here 
    Dim rowHeaderContextMenu As New FarPoint.Web.Spread.ContextMenu()
    rowHeaderContextMenu.Type = FarPoint.Web.Spread.ContextMenuType.RowHeader
    Dim rowHeaderItem As New FarPoint.Web.Spread.MenuItem("RowHeader item 1")
    rowHeaderItem.ChildItems.Add(New FarPoint.Web.Spread.MenuItem("Child item 1"))
    rowHeaderItem.ChildItems.Add(New FarPoint.Web.Spread.MenuItem("Child item 2"))
    rowHeaderItem.ChildItems(1).Visible = True
    rowHeaderContextMenu.Items.Add(rowHeaderItem)
    FpSpread1.ContextMenus.Add(rowHeaderContextMenu)
    See Also