Retrieve Name of a shape


  • StephC 2 months, 2 weeks ago


    How to know the name of the shape that is clicked in \”Private Sub fp_ShapeActivated (sender As Object, e As EventArgs) Handles fp.ShapeActivated\”

    (VB NET, Spread 7.35)

    Thank you


  • 50p
    Deepak Sharma50p 2 months, 2 weeks ago

    Hi Stephane,

    You can add the event handler for shape click event and get the shape name there. Please have a look at the code below:

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
            Dim rShape As New FarPoint.Win.Spread.DrawingSpace.RectangleShape()
            rShape.Name = “rShape1″
            rShape.Top = 20
            rShape.Left = 60
            rShape.BackColor = Color.Blue
            rShape.Width = 100
            rShape.Height = 100
            AddHandler rShape.Click, AddressOf Me.rShapeClick
        End Sub
        Private Sub rShapeClick(sender As Object, e As EventArgs)
            Dim strName As String
            strName = DirectCast(sender, FarPoint.Win.ElementWindowless).Name
            MessageBox.Show(“you clicked on ” + strName)
        End Sub

    Please refer to the attached sample application as well.

    Deepak Sharma

    You must be logged in to view attched files.
  • 122p
    Sean Lawyer122p 2 months, 2 weeks ago


    You can use spread.ActiveWindowlessObject to get the current active shape (if there is one — this property might return Nothing or null), then check its Name property.


Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to create new topics.