

| Type | Description |
private void RClick(object sender)
{
}
Private Sub RClick(ByVal sender As System.Object) Handles RClick End Sub |
private void RClick(object sender, EventArgs e)
{
}
void OnRClick()
{
}
void __fastcall RClick(TObject *Sender)
{
}
procedure RClick(ASender: TObject; ); begin end; procedure RClick(sender: System.Object; e: System.EventArgs); begin end; begin event RClick() end event RClick Private Sub RClick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RClick End Sub Private Sub RClick() End Sub Private Sub RClick() End Sub LPARAMETERS nop PROCEDURE OnRClick(oGraph) RETURN |
<SCRIPT EVENT="RClick()" LANGUAGE="JScript"> </SCRIPT> <SCRIPT LANGUAGE="VBScript"> Function RClick() End Function </SCRIPT> Procedure OnComRClick Forward Send OnComRClick End_Procedure METHOD OCX_RClick() CLASS MainDialog RETURN NIL void onEvent_RClick()
{
}
function RClick as v () end function function nativeObject_RClick() return |
The following VB sample use Exontrol's ExPopupMenu Component to display a context menu when user has clicked the right mouse button in the control's client area:
Private Sub Graph1_RClick() Dim i As Long i = PopupMenu1.ShowAtCursor End Sub
If you need to add a context menu based on the item you can use the MouseUp event, like in the following VB sample:
Private Sub Graph1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
If (Button = 2) Then
' Converts the container coordinates to client coordinates
X = X / Screen.TwipsPerPixelX
Y = Y / Screen.TwipsPerPixelY
Dim h As HITEM
Dim c As Long, hit as Long
' Gets the item from (X,Y)
h = Graph1.ItemFromPoint(X, Y, c, hit)
If Not (h = 0) Then
Dim i As Long
PopupMenu1.Items.Add Graph1.Items.CellCaption(h, c)
i = PopupMenu1.ShowAtCursor
End If
End If
End Sub
The following VC sample displays the caption of the cell where the mouse is released:
#include "Items.h"
static CString V2S( VARIANT* pv, LPCTSTR szDefault = _T("") )
{
if ( pv )
{
if ( pv->vt == VT_ERROR )
return szDefault;
COleVariant vt;
vt.ChangeType( VT_BSTR, pv );
return V_BSTR( &vt );
}
return szDefault;
}
void OnMouseUpGraph1(short Button, short Shift, long X, long Y)
{
long c = 0, hit = 0, hItem = m_graph.GetItemFromPoint( X, Y, &c, &hit );
if ( ( hItem != 0 ) || ( c != 0 ) )
{
CItems items = m_graph.GetItems();
COleVariant vtItem( hItem ), vtColumn( c );
CString strCaption = V2S( &items.GetCellValue( vtItem, vtColumn ) ), strOutput;
strOutput.Format( "Cell: '%s', Hit = %08X\n", strCaption, hit );
OutputDebugString( strOutput );
}
}
The following VB.NET sample displays the caption of the cell where the mouse is released:
Private Sub AxGraph1_MouseUpEvent(ByVal sender As Object, ByVal e As AxEXGRAPHLib._IGraphEvents_MouseUpEvent) Handles AxGraph1.MouseUpEvent
With AxGraph1
Dim i As Integer, c As Integer, hit As EXGRAPHLib.HitTestInfoEnum
i = .get_ItemFromPoint(e.x, e.y, c, hit)
If (Not (i = 0) Or Not (c = 0)) Then
Debug.WriteLine("Cell: " & .Items.CellCaption(i, c) & " Hit: " & hit.ToString())
End If
End With
End Sub
The following C# sample displays the caption of the cell where the mouse is released:
private void axGraph1_MouseUpEvent(object sender, AxEXGRAPHLib._IGraphEvents_MouseUpEvent e)
{
int c = 0;
EXGRAPHLib.HitTestInfoEnum hit;
int i = axGraph1.get_ItemFromPoint( e.x, e.y, out c,out hit );
if ( ( i != 0 ) || ( c != 0 ) )
{
string s = axGraph1.Items.get_CellCaption( i,c ).ToString();
s = "Cell: " + s + ", Hit: " + hit.ToString();
System.Diagnostics.Debug.WriteLine( s );
}
}
The following VFP sample displays the caption of the cell where the mouse is released:
*** ActiveX Control Event *** LPARAMETERS button, shift, x, y local c, hit c = 0 hit = 0 with thisform.Graph1 .Items.DefaultItem = .ItemFromPoint( x, y, @c, @hit ) if ( .Items.DefaultItem <> 0 ) or ( c <> 0 ) wait window nowait .Items.CellCaption( 0, c ) + " " + Str( hit ) endif endwith