property Bar.EndColor as Color
Returns or sets a value that indicates the color for the right side corner.

 TypeDescription 
   Color A Color expression that indicates the color for the ending part of the bar.  
Use the EndColor property to specify the color to fill the end part of the bar, if the EndShape property is not exShapeIconEmpty. Use the Color property to specify the color to fill the middle part of the bar. Use the StartColor and StartShape properties to define the look and feel for the starting part of the bar. Use the AddShapeCorner property to add custom icons to the bars. In this case, the icon is processed before displaying based on the StartColor/ EndColor property. For instance, if you add an black and white icon, and the StartColor/EndColor is red, the icon will be painted in red. Instead, if the StartColor/EndColor property is -1 ( 0xFFFFFFFF, not white which is 0x00FFFFFF ), the icon is painted as it was added using the AddShapeCorner without any image processing. If the StartColor/EndColor property is not -1, it indicates the color being applied to the icon.

In VB.NET or C# you require the following functions until the .NET framework will provide:

You can use the following VB.NET function:
     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 
You can use the following C# function:
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 VB sample defines a new bar that looks like this :

With Gantt1.Chart.Bars.Add("Task2")
    .Pattern = exPatternShadow
    .Color = RGB(0, 0, 255)
    .EndShape = exShapeIconCircleDot
    .EndColor = RGB(255, 0, 0)
End With

The following C++ sample defines a bar that looks like this above:

CBar bar = m_gantt.GetChart().GetBars().Add("Task2");
bar.SetPattern( 3 /*exPatternShadow*/ );
bar.SetColor( RGB(0, 0, 255) );
bar.SetEndShape( 4 /* exShapeIconCircleDot*/ );
bar.SetEndColor( RGB(255, 0, 0) );

The following VB.NET sample defines a bar that looks like this above:

With AxGantt1.Chart.Bars.Add("Task2")
    .Pattern = EXGANTTLib.PatternEnum.exPatternShadow
    .Color = RGB(0, 0, 255)
    .EndShape = EXGANTTLib.ShapeCornerEnum.exShapeIconCircleDot
    .EndColor = RGB(255, 0, 0)
End With

The following C# sample defines a bar that looks like this above:

EXGANTTLib.Bar bar = axGantt1.Chart.Bars.Add("Task2");
bar.Pattern = EXGANTTLib.PatternEnum.exPatternShadow;
bar.Color = ToUInt32(Color.FromArgb(0, 0, 255));
bar.EndShape = EXGANTTLib.ShapeCornerEnum.exShapeIconCircleDot;
bar.EndColor = ToUInt32(Color.FromArgb(255, 0, 0));

The following VFP sample defines a bar that looks like this above:

with thisform.Gantt1.Chart.Bars.Add("Task2")
	.Pattern = 3 && exPatternShadow
	.Color = RGB(0, 0, 255)
	.EndShape = 4 && exShapeIconCircleDot
	.EndColor = RGB(255, 0, 0)
EndWith

 


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