Type | Description | |||
Name as String | A String expression that indicates the name of the bar being copied. | |||
NewName as String | A String expression that indicates the name of the new bar. |
Return | Description | |||
Bar | A Bar object being created. |
Use the Copy property create a clone for a specified bar. Use the Shape, Pattern and Color properties to define the appearance for the middle part of the bar. Use the StartShape and StartColor properties to define the appearance for the starting part of the bar. Use the EndShape and EndColor properties to define the appearance for the ending part of the bar.
The following VB sample creates a new bar called "Task2", that's similar with the "Task" bar excepts that we change the color to fill the bar:
With G2antt1.Chart.Bars With .Copy("Task", "Task2") .Color = RGB(255, 0, 0) End With End With
The following C++ sample creates a new bar called "Task2", that's similar with the "Task" bar excepts that we change the color to fill the bar:
CBars bars = m_g2antt.GetChart().GetBars(); CBar bar = bars.Copy( "Task", "Task2" ); bar.SetColor( RGB(255,0,0) );
The following VB.NET sample creates a new bar called "Task2", that's similar with the "Task" bar excepts that we change the color to fill the bar:
With AxG2antt1.Chart.Bars With .Copy("Task", "Task2") .Color = ToUInt32(Color.Red) End With End With
The following C# sample creates a new bar called "Task2", that's similar with the "Task" bar excepts that we change the color to fill the bar:
EXG2ANTTLib.Bar bar = axG2antt1.Chart.Bars.Copy("Task", "Task2"); bar.Color = ToUInt32(Color.Red);
The following VFP sample creates a new bar called "Task2", that's similar with the "Task" bar excepts that we change the color to fill the bar:
with thisform.G2antt1.Chart.Bars with .Copy("Task", "Task2" ) .Color = RGB(255,0,0) endwith endwith
In VB.NET or C# you require the following functions until the .NET framework will provide:
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
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); }