method Bars.AddShapeCorner (Key as Variant, Icon as Variant)
Adds a custom shape corner.

 TypeDescription 
   Key as Variant A Long expression that indicates the key of the new icon being added  
   Icon as Variant A long expression that indicates the handle of the icon being inserted, or the index of the icon being added.  
Use the AddShapeCorner method to define a corner from an icon. Use the StartShape and EndShape properties to define the start and end parts of the bar using custom shapes. Use the Images or ReplaceIcon method to update the list of control's icons. Use the RemoveShapeCorner method to remove a custom shape. The control includes a list of predefined shapes like shown in the ShapeCornerEnum type. 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.

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

With .Chart.Bars
            .AddShapeCorner 12345, 1
            With .Add("Task2")
                .Pattern = exPatternDot
                .Shape = exShapeThinDown
                .EndShape = 12345
                .EndColor = RGB(255, 0, 0)
                .Color = .EndColor
            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.SetEndShape( 12345 );
bar.SetEndColor( RGB(255, 0, 0) );
bar.SetColor( bar.GetEndColor() );

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
        .EndShape = 12345
        .EndColor = RGB(255, 0, 0)
        .Color = .EndColor
    End With
End With

The following VB.NET sample adds a custom icon to the start of all Task bars:

With AxGantt1.Chart.Bars
    .AddShapeCorner(12345, 1)
    .Item("Task").StartShape = 12345
    .Item("Task").StartColor = UInteger.MaxValue
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.EndShape = (EXGANTTLib.ShapeCornerEnum)12345;
bar.EndColor = ToUInt32(Color.FromArgb(255, 0, 0));
bar.Color = bar.EndColor;

The following C# sample adds a custom icon to the start of all Task bars:

EXGANTTLib.Bars bars = axGantt1.Chart.Bars;
bars.AddShapeCorner(12345, 1);
bars["Task"].StartShape = EXGANTTLib.ShapeCornerEnum.exShapeIconEmpty + 12345;
bars["Task"].StartColor = 0xFFFFFFFF;

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
	    .EndShape = 12345
	    .EndColor = RGB(255, 0, 0)
	    .Color = .EndColor
	EndWith
EndWith


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