Spread Windows Forms 10.0 Product Documentation
TouchToolBarButton Constructor(ITouchBarAction,String,Image)
Example 


Indicates the action which is executed by click.
Indicates the button text.
Indicates the button image.
Initializes a new instance of the TouchToolBarButton class.
Syntax
'Declaration
 
Public Function New( _
   ByVal action As ITouchBarAction, _
   ByVal text As String, _
   ByVal image As Image _
)
'Usage
 
Dim action As ITouchBarAction
Dim text As String
Dim image As Image
 
Dim instance As New TouchToolBarButton(action, text, image)
public TouchToolBarButton( 
   ITouchBarAction action,
   string text,
   Image image
)

Parameters

action
Indicates the action which is executed by click.
text
Indicates the button text.
image
Indicates the button image.
Example
This example creates touch toolbar buttons.
public class SelectAction : GrapeCity.Win.Spread.InputMan.CellType.ITouchBarAction
        {

            public bool CanExecute(object target)
            {
                GrapeCity.Win.Spread.InputMan.CellType.EditBase owner = target;
                if (owner == null)
                {
                    return false;
                }
                return true;
            }

            public void Execute(object target)
            {
                GrapeCity.Win.Spread.InputMan.CellType.EditBase owner = target;
                owner.SelectAll();
            }
        }

        public class DeselectAction : GrapeCity.Win.Spread.InputMan.CellType.ITouchBarAction
        {

            public bool CanExecute(object target)
            {
                GrapeCity.Win.Spread.InputMan.CellType.EditBase owner = target;
                if (owner == null)
                {
                    return false;
                }
                return true;
            }

            public void Execute(object target)
            {
                GrapeCity.Win.Spread.InputMan.CellType.EditBase owner = target;                
                owner.DeselectAll();
            }
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            GrapeCity.Win.Spread.InputMan.CellType.TouchToolBarButton selectBtn = new GrapeCity.Win.Spread.InputMan.CellType.TouchToolBarButton(new SelectAction(), "test1", null);
            GrapeCity.Win.Spread.InputMan.CellType.TouchToolBarButton deselectBtn = new GrapeCity.Win.Spread.InputMan.CellType.TouchToolBarButton(new DeselectAction(), "test2", null);
            GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType imtc = new GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType();
            imtc.ShowTouchToolBar = GrapeCity.Win.Spread.InputMan.CellType.TouchToolBarDisplayOptions.TapSelection | GrapeCity.Win.Spread.InputMan.CellType.TouchToolBarDisplayOptions.TapGripper;
            imtc.TouchToolBar.Items.Clear();
            imtc.TouchToolBar.Items.AddRange(new ToolStripItem[] {
        selectBtn,
        new ToolStripSeparator(),
        deselectBtn
    });
            fpSpread1.ActiveSheet.Columns[0].CellType = imtc;           
        }
Public Class SelectAction
        Implements GrapeCity.Win.Spread.InputMan.CellType.ITouchBarAction

        Public Function CanExecute(target As Object) As Boolean Implements GrapeCity.Win.Spread.InputMan.CellType.ITouchBarAction.CanExecute
            Dim owner As GrapeCity.Win.Spread.InputMan.CellType.EditBase = target
            If owner Is Nothing Then
                Return False
            End If
            Return True
        End Function

        Public Sub Execute(target As Object) Implements GrapeCity.Win.Spread.InputMan.CellType.ITouchBarAction.Execute
            Dim owner As GrapeCity.Win.Spread.InputMan.CellType.EditBase = target
            owner.SelectAll()
        End Sub
    End Class

    Public Class DeselectAction
        Implements GrapeCity.Win.Spread.InputMan.CellType.ITouchBarAction

        Public Function CanExecute(target As Object) As Boolean Implements GrapeCity.Win.Spread.InputMan.CellType.ITouchBarAction.CanExecute
            Dim owner As GrapeCity.Win.Spread.InputMan.CellType.EditBase = target
            If owner Is Nothing Then
                Return False
            End If
            Return True
        End Function

        Public Sub Execute(target As Object) Implements GrapeCity.Win.Spread.InputMan.CellType.ITouchBarAction.Execute
            Dim owner As GrapeCity.Win.Spread.InputMan.CellType.EditBase = target
            owner.DeselectAll()
        End Sub
    End Class

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Dim selectBtn As New GrapeCity.Win.Spread.InputMan.CellType.TouchToolBarButton(New SelectAction(), "test1", Nothing)
        Dim deselectBtn As New GrapeCity.Win.Spread.InputMan.CellType.TouchToolBarButton(New DeselectAction(), "test2", Nothing)
        Dim imtc As New GrapeCity.Win.Spread.InputMan.CellType.GcTextBoxCellType()
        imtc.ShowTouchToolBar = GrapeCity.Win.Spread.InputMan.CellType.TouchToolBarDisplayOptions.TapSelection Or GrapeCity.Win.Spread.InputMan.CellType.TouchToolBarDisplayOptions.TapGripper
        imtc.TouchToolBar.Items.Clear()
        imtc.TouchToolBar.Items.AddRange(New ToolStripItem() {selectBtn, New ToolStripSeparator(), deselectBtn})
        FpSpread1.ActiveSheet.Columns(0).CellType = imtc
    End Sub
End Class
Requirements

Target Platforms: Windows 2000 Professional (SP4), Windows 2000 Server, Windows 2003 Server (SP1), Windows Server 2012 R2, Windows 2008, Windows XP (SP2), Windows Vista, Windows 7, Windows 8, Windows 8.1, Windows 10

See Also

Reference

TouchToolBarButton Class
TouchToolBarButton Members
Overload List

 

 


Copyright © GrapeCity, inc. All rights reserved.