property ChartView.SelColor as Color
Retrieves or sets a value that indicates the color used to mark the selected node.

 TypeDescription 
   Color A color expression that indicates the color used to mark the selected node. The last 7 bits in the high significant byte of the color to indicates the identifier of the skin being used. Use the Add method to add new skins to the control. If you need to remove the skin appearance from a part of the control you need to reset the last 7 bits in the high significant byte of the color being applied to the background's part.  

A disabled node is painted as non selected. Use the SelectNode property to determine the selected node. For instance, if the SelColor property has the same value as BackColor property, the control doesn't paint the mark around the selected node. The control fires the Select event when a node is selected. 

The following VB sample changes the visual appearance for the selected node. The SelColor property indicates the selection background color. Shortly, we need to add a skin to the Appearance object using the Add method, and we need to set the last 7 bits in the SelColor property to indicate the index of the skin that we want to use. The sample applies the "" to the selected node(s):

With ChartView1
    .VisualAppearance.Add 1, "D:\Temp\ExOrgChart.Help\select.ebn"
    .SelColor = &H1000000
End With

The following C++ sample changes the visual appearance for the selected node:

#include "Appearance.h"
m_chartview.GetVisualAppearance().Add( 1, COleVariant("D:\\Temp\\ExOrgChart.Help\\select.ebn") );
m_chartview.SetSelColor( 0x1000000 );

The following VB.NET sample changes the visual appearance for the selected node:

With AxChartView1
    .VisualAppearance.Add(1, "D:\Temp\ExOrgChart.Help\select.ebn")
    .Template = "SelColor = 16777216"
End With

The following C# sample changes the visual appearance for the selected node:

axChartView1.VisualAppearance.Add(1, "D:\\Temp\\ExOrgChart.Help\\select.ebn");
axChartView1.Template = "SelColor = 16777216";

The following VFP sample changes the visual appearance for the selected node:

With thisform.ChartView1
    .VisualAppearance.Add(1, "D:\Temp\ExOrgChart.Help\select.ebn")
    .SelColor = 16777216
EndWith

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-2016 Exontrol.COM, Software. All rights reserved.