method Bars.Add (Name as String)
Adds a Bar object to the collection and returns a reference to the newly created object.

 TypeDescription 
   Name as String A String expression that indicates the of the bar being inserted.  
 ReturnDescription 
  BarA Bar object being inserted. 
The Add method adds a new bar to the Bars collection. Use the AddBar property to add a new bar to an item. 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 Name property indicates the name of the bar. Use the Copy property to create a clone bar. By default, the Bars collection includes the following predefined bars:

The following VB sample adds a custom shape and defines a bar like this :

With Gantt1.Chart.Bars
    .AddShapeCorner 12345, 1
    With .Add("Task2")
        .Pattern = exPatternDot
        .Shape = exShapeThinDown
        .StartShape = 12345
        .StartColor = RGB(255, 0, 0)
        .Color = .StartColor
    End With
End With

The following C++ sample adds a custom shape and defines a bar like above:

CBars bars = m_gantt.GetChart().GetBars();
bars.AddShapeCorner( COleVariant( (long)12345 ), COleVariant( (long)1 ) );
CBar bar = bars.Add("Task2");
bar.SetPattern( 2 /*exPatternDot*/ );
bar.SetShape( 20 /*exShapeThinDown*/ );
bar.SetStartShape( 12345 );
bar.SetStartColor( RGB(255, 0, 0) );
bar.SetColor( bar.GetStartColor() );

The following VB.NET sample adds a custom shape and defines a bar like above:

With AxGantt1.Chart.Bars
    .AddShapeCorner(12345, 1)
    With .Add("Task2")
        .Pattern = EXGANTTLib.PatternEnum.exPatternDot
        .Shape = EXGANTTLib.ShapeBarEnum.exShapeThinDown
        .StartShape = 12345
        .StartColor = RGB(255, 0, 0)
        .Color = .StartColor
    End With
End With

The following C# sample adds a custom shape and defines a bar like above:

axGantt1.Chart.Bars.AddShapeCorner(12345, 1);
EXGANTTLib.Bar bar = axGantt1.Chart.Bars.Add("Task2");
bar.Pattern = EXGANTTLib.PatternEnum.exPatternDot;
bar.Shape = EXGANTTLib.ShapeBarEnum.exShapeThinDown;
bar.StartShape = (EXGANTTLib.ShapeCornerEnum)12345;
bar.StartColor = ToUInt32(Color.FromArgb(255, 0, 0));
bar.Color = bar.StartColor;

The following VFP sample adds a custom shape and defines a bar like above:

With thisform.Gantt1.Chart.Bars
	.AddShapeCorner(12345, 1)
	With .Add("Task2")
	    .Pattern = 2 && exPatternDot
	    .Shape = 20 && exShapeThinDown
	    .StartShape = 12345
	    .StartColor = RGB(255, 0, 0)
	    .Color = .StartColor
	EndWith
EndWith

 


Send comments on this topic.
© 1999-2006 Exontrol Inc, Software. All rights reserved.