disable context menu on RowHeader

Posted by: suvi on 8 September 2017, 12:56 pm EST

  • Posted 8 September 2017, 12:56 pm EST

    Hello


    I want to disable contextmenu on RowHeader. and also how to auto size Rowheader to adjust with the text.


    Please suggest how to solve this issues.


    Regards


    Deepak


     


     


     


     


     

  • Replied 8 September 2017, 12:56 pm EST

    suvi -

    Is this a context menu you have set up for the spread?  If so you can use the CellClick event and query if you are using the right mouse button then query if you are clicking in a row header.  If both return true then you can cancel the event.

    Use the GetPreferredRowHeight to adjust the height of the row.
  • Replied 8 September 2017, 12:56 pm EST

    Hi Bob


    Thanks for u r reply. i've written this code but it is not working plz suggest where is the problem:


    private void m_grid_CellClick(object sender, FarPoint.Win.Spread.CellClickEventArgs e)


    {


          if (e.Button == MouseButtons.Right && e.RowHeader == true)


                      e.Cancel = true;


    }


     


    Thanks


    Deepak

  • Replied 8 September 2017, 12:56 pm EST

    Deepak -

    Try the following instead...

    Private Sub FpSpread1_CellClick(ByVal sender As Object, ByVal e As FarPoint.Win.Spread.CellClickEventArgs) Handles FpSpread1.CellClick
    If e.Button = Windows.Forms.MouseButtons.Right And e.RowHeader = True Then
    FpSpread1.ContextMenu = Nothing
    Else
    FpSpread1.ContextMenu = cm
    End If
    End Sub

    cm is my ContextMenu
Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels