property Level.BackColor as Color
Specifies the level's background color.

 TypeDescription 
   Color A Color expression that indicates the level's background color. 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.  
Use the BackColor property to specify the background color for a specified level. Use the ForeColor property to specify the foreground color for a specified level. Use the BackColorLevelHeader property to specify the background color of the chart's header. Use the ForeColorLevelHeader property to specify the foreground color of the chart's header. Use the BackColor property to specify the chart's background color. Use the ForeColor property to specify the chart's foreground color. Use the ItemBackColor property to change the item's background color. Use the NonworkingDaysColor property the color of the brush to fill the nonworking days area. 

The following VB sample changes the appearance for the last level:

With G2antt1.Chart
    With .Level(.LevelCount - 1)
        .BackColor = SystemColorConstants.vbDesktop
        .ForeColor = RGB(255, 255, 255)
    End With
End With

The following C++ sample changes the appearance for the last level:

CLevel level = m_g2antt.GetChart().GetLevel(m_g2antt.GetChart().GetLevelCount()-1);
level.SetBackColor( 0x80000000 | COLOR_DESKTOP );
level.SetForeColor( RGB(255,255,255) );

The following VB.NET sample changes the appearance for the last level:

With AxG2antt1.Chart
    With .Level(.LevelCount - 1)
        .BackColor = ToUInt32(SystemColors.Desktop)
        .ForeColor = RGB(255, 255, 255)
    End With
End With

where the ToUInt32 function converts a Color expression to an OLE_COLOR type:

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 appearance for the last level:

EXG2ANTTLib.Level level = axG2antt1.Chart.get_Level(axG2antt1.Chart.LevelCount - 1);
level.BackColor = ToUInt32(SystemColors.Desktop);
level.ForeColor = ToUInt32(Color.FromArgb(255,255,255));

where the ToUInt32 function converts a Color expression to an OLE_COLOR type:

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 appearance for the last level:

With thisform.G2antt1.Chart
    With .Level(.LevelCount - 1)
        .BackColor = 0x80000001
        .ForeColor = RGB(255, 255, 255)
    EndWith
EndWith


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