Jump to content
Software FX Community

Custom AxisSection context menu ( ContextMenuAxisSection ?)


Recommended Posts

I'm creating an AxisSection and highlighting it in the MouseDown, MouseMove and MouseUp events, and now I need to add some context menu items that appear only when the user right-clicks that section of the grid. I was guessing that I should use CommandId.ContextMenuAxisSection, but I can't find any explanation of it in the documentation or online, and I can't seem to get such a context menu to appear. When that section is right-clicked, the ContextMenuAxis appears, so I'm adding my menu items to that for now, but I really don't want those menu items to be available when the user actually clicks the axis. Is there a way to do what I want to do? What is the ContextMenuAxisSection used for?

Link to comment
Share on other sites

Unfortunately, according to SoftwareFX support, you can't create your own Context Menu to be used only when you right click on the Axis Section.

As a workaround, I'm adding the Context Menu Items to the Axis Context Menu and disabling the Context Menu Items depending where you the user is clicking, which is revealed in the MouseClick event's e (HitTestEventArgs) parameter. Something like this:

Private Const MyCommandID As Integer = 1

Private Sub Chart_MouseClick(ByVal sender As System.Object, ByVal e As ChartFX.WinForms.HitTestEventArgs) _

Handles Chart.MouseClick

If e.Button = MouseButtons.Right Then

Chart.Commands(MyCommandID).Enabled = (e.HitType = HitType.AxisSection)

End If

End Sub

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...