disable context menu on RowHeader

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

  • Posted 8 September 2017, 12:56 pm EST


    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.








  • 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:

    <FONT color=#0000ff size=2>

    private</FONT><FONT size=2> </FONT><FONT color=#0000ff size=2>void</FONT><FONT size=2> m_grid_CellClick(</FONT><FONT color=#0000ff size=2>object</FONT><FONT size=2> sender, FarPoint.Win.Spread.</FONT><FONT color=#008080 size=2>CellClickEventArgs</FONT><FONT size=2> e)


    </FONT><FONT color=#0000ff size=2>      if</FONT><FONT size=2> (e.Button == </FONT><FONT color=#008080 size=2>MouseButtons</FONT><FONT size=2>.Right && e.RowHeader == </FONT><FONT color=#0000ff size=2>true</FONT><FONT size=2>)</FONT>

    <FONT size=2>                  e.Cancel = </FONT><FONT color=#0000ff size=2>true</FONT><FONT size=2>;






  • 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
    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