Spread Windows Forms 11.0 Product Documentation
TouchStripOpening Event
Example 


FarPoint.Win.Spread Assembly > FarPoint.Win.Spread Namespace > FpSpread Class : TouchStripOpening Event
Occurs when FpSpread tries to show a FarPoint.Win.Spread.TouchStrip in a touch device.
Syntax
'Declaration
 
Public Event TouchStripOpening As EventHandler(Of TouchStripOpeningEventArgs)
'Usage
 
Dim instance As FpSpread
Dim handler As EventHandler(Of TouchStripOpeningEventArgs)
 
AddHandler instance.TouchStripOpening, handler
public event EventHandler<TouchStripOpeningEventArgs> TouchStripOpening
Event Data

The event handler receives an argument of type TouchStripOpeningEventArgs containing data related to this event. The following TouchStripOpeningEventArgs properties provide information specific to this event.

PropertyDescription
Indicates what area should display a SpreadTouchStrip.  
(Inherited from System.ComponentModel.CancelEventArgs)
Gets or sets a value that indicates whether to keep the selection.  
Gets or sets the horizontal position for the tapped position.  
Gets or sets the vertical position for the tapped position.  
Remarks
If some objects are already selected, such as cell, row, column, shape, or chart, and you tap the objects again, FpSpread raises this event to show a FarPoint.Win.Spread.TouchStrip. You can create your own FarPoint.Win.Spread.TouchStrip and show it in the event handler. To do so, set the TouchStripOpeningEventArgs.Cancel to true. Set the TouchStripOpeningEventArgs.UseBuiltInTouchStrip to True to make FpSpread show a built-in FarPoint.Win.Spread.TouchStrip.
Example
This example  creates a touch strip menu.
void autoFill_Click(object sender, EventArgs e)
        {
         FarPoint.Win.Spread.SpreadView activeView = fpSpread1.GetRootWorkbook().GetActiveWorkbook();
            if (activeView != null)
            {
                activeView.ShowAutoFillIndicator();
            }
        }

        private void fpSpread1_TouchStripOpening(object sender, FarPoint.Win.Spread.TouchStripOpeningEventArgs e)
        {
            e.Cancel = true;
            FarPoint.Win.Spread.CellTouchStrip touchStrip = new FarPoint.Win.Spread.CellTouchStrip(this.fpSpread1);
            touchStrip.Items["Cut"].Visible = false;
            ToolStripSeparator separator1 = new ToolStripSeparator();
            FarPoint.Win.Spread.TouchStripButton autoFill = new FarPoint.Win.Spread.TouchStripButton("AutoFill", System.Drawing.Image.FromFile("C:\\SpreadWin7\\dragfill.png"));
            autoFill.Click += autoFill_Click;

            ToolStripSeparator separator2 = new ToolStripSeparator();
            ToolStripDropDownButton dropDownMenu = new ToolStripDropDownButton(System.Drawing.Image.FromFile("C:\\SpreadWin7\\dropdown.png"));
            dropDownMenu.ShowDropDownArrow = false;
            dropDownMenu.ImageScaling = ToolStripItemImageScaling.None;
            ContextMenuStrip menu = new System.Windows.Forms.ContextMenuStrip();
            menu.Items.Add("Item1");
            dropDownMenu.DropDown = menu;

            touchStrip.Items.AddRange(new ToolStripItem[] { separator1, autoFill, separator2, dropDownMenu });
            touchStrip.Show(new Point(e.X - 20, e.Y - 35 - touchStrip.Height));
        }
Private Sub autoFill_Click(sender As Object, e As EventArgs)
Dim activeView As FarPoint.Win.Spread.SpreadView = fpSpread1.GetRootWorkbook().GetActiveWorkbook()
If activeView IsNot Nothing Then
activeView.ShowAutoFillIndicator()
End If
End Sub

Private Sub fpSpread1_TouchStripOpening(sender As Object, e As FarPoint.Win.Spread.TouchStripOpeningEventArgs)
e.Cancel = True
Dim touchStrip As New FarPoint.Win.Spread.CellTouchStrip(Me.fpSpread1)
touchStrip.Items("Cut").Visible = False
Dim separator1 As New ToolStripSeparator()
Dim autoFill As New FarPoint.Win.Spread.TouchStripButton("AutoFill", System.Drawing.Image.FromFile("C:\SpreadWin7\dragfill.png"))
 AddHandler autoFill.Click, AddressOf autoFill_Click

Dim separator2 As New ToolStripSeparator()
Dim dropDownMenu As New ToolStripDropDownButton(System.Drawing.Image.FromFile("C:\SpreadWin7\dropdown.png"))
dropDownMenu.ShowDropDownArrow = False
dropDownMenu.ImageScaling = ToolStripItemImageScaling.None
Dim menu As ContextMenuStrip = New System.Windows.Forms.ContextMenuStrip()
menu.Items.Add("Item1")
dropDownMenu.DropDown = menu

touchStrip.Items.AddRange(New ToolStripItem() {separator1, autoFill, separator2, dropDownMenu})
touchStrip.Show(New Point(e.X - 20, e.Y - 35 - touchStrip.Height))
End Sub
See Also