event Select (OldNode as Node, NewNode as Node)
Occurs when the user selects a node.

 TypeDescription 
   OldNode as Node A Node object that indicates the previous selected node.  
   NewNode as Node A Node object that indicates the currently  selected node.  

Use the Select event to notify your application that user changes the selected node. Use the SelectNode property to determine the selected node. Use the Caption property to specify the caption of the node. Use the BackColor property to specify the node's background color. Use the ForeColor property to specify the node's background color. The control automatically scrolls the control's content to ensure that the node being clicked fits the control's client area, if the EnsureVisibleOnSelect property is True.

The following VB sample changes the background and foreground color for the selected node:

Private Sub ChartView1_Select(ByVal OldNode As EXORGCHARTLibCtl.INode, ByVal NewNode As EXORGCHARTLibCtl.INode)
    If Not (OldNode Is Nothing) Then
        With OldNode
            .ClearBackColor
            .ClearForeColor
        End With
    End If
    With NewNode
        .ForeColor = vbWhite
        .BackColor = vbBlue
    End With
End Sub

The following C++ sample changes the background and foreground color for the selected node:

void OnSelectChartview1(LPDISPATCH OldNode, LPDISPATCH NewNode) 
{
	CNode oldNode( OldNode ); oldNode.m_bAutoRelease = FALSE;
	CNode newNode( NewNode ); newNode.m_bAutoRelease = FALSE;

	if ( oldNode.m_lpDispatch != NULL )
	{
		oldNode.ClearBackColor();
		oldNode.ClearForeColor();
	}
	newNode.SetBackColor( RGB(0,0,128) );
	newNode.SetForeColor( RGB(255,255,255) );
}

The following VB.NET sample changes the background and foreground color for the selected node:

Private Sub AxChartView1_SelectEvent(ByVal sender As System.Object, ByVal e As AxEXORGCHARTLib._IChartViewEvents_SelectEvent) Handles AxChartView1.SelectEvent
    If Not (e.oldNode Is Nothing) Then
        With e.oldNode
            .ClearBackColor()
            .ClearForeColor()
        End With
    End If
    With e.newNode
        .ForeColor = ToUInt32(Color.White)
        .BackColor = ToUInt32(Color.Blue)
    End With
End Sub

where the ToUInt32 function converts a Color expression to OLE_COLOR,

Shared Function ToUInt32(ByVal c As Color) As UInt32
    Dim i As Long
    i = c.R
    i = i + 256 * c.G
    i = i + 256 * 256 * c.B
    ToUInt32 = Convert.ToUInt32(i)
End Function

The following C# sample changes the background and foreground color for the selected node:

private void axChartView1_SelectEvent(object sender, AxEXORGCHARTLib._IChartViewEvents_SelectEvent e)
{
	if ( e.oldNode != null )
	{
		e.oldNode.ClearBackColor();
		e.oldNode.ClearForeColor();
	}
	e.newNode.BackColor = ToUInt32(Color.Blue);
	e.newNode.ForeColor = ToUInt32(Color.White);
}

where the ToUInt32 function converts a Color expression to OLE_COLOR,

private UInt32 ToUInt32(Color c)
{
	long i;
	i = c.R;
	i = i + 256 * c.G;
	i = i + 256 * 256 * c.B;
	return Convert.ToUInt32(i);
}

The following VFP sample changes the background and foreground color for the selected node:

*** ActiveX Control Event ***
LPARAMETERS oldnode, newnode

If !isnull(oldnode)
    With oldnode
        .ClearBackColor
        .ClearForeColor
    EndWith
EndIf
With newnode
    .ForeColor = RGB(255,255,255)
    .BackColor = RGB(0,0,128)
EndWith


 


Send comments on this topic.
© 1999-2011 Exontrol.COM, Software. All rights reserved.