![]() | Type | Description | ||
| Item as HITEM | A HITEM expression that indicates the handle of the item where the bar is resized. | |||
| Key as Variant | A VARIANT expression that indicates the key of the bar being resized. The Key parameter of the AddBar property specifies the key of the bar being added. |
The following VB sample displays the operation performed as if it was a moving or a resizing the bar:
Private Sub G2antt1_BarResize(ByVal Item As EXG2ANTTLibCtl.HITEM, ByVal Key As Variant)
With G2antt1.Items
If .ItemBar(Item, Key, exBarDurationPrev) <> .ItemBar(Item, Key, exBarDuration) Then
Debug.Print "The item has been resized."
Else
Debug.Print "The item has been moved."
End If
End With
End Sub
The following VB sample displays the new start and end data for the bar being moved or resized:
Private Sub G2antt1_BarResize(ByVal Item As EXG2ANTTLibCtl.HITEM, ByVal Key As Variant)
With G2antt1.Items
Debug.Print "NewStart: " & .ItemBar(Item, Key, exBarStart)
Debug.Print "NewEnd: " & .ItemBar(Item, Key, exBarEnd)
End With
End Sub
The following VB sample changes the background color of the bar being moved or renamed:
Private Sub G2antt1_BarResize(ByVal Item As EXG2ANTTLibCtl.HITEM, ByVal Key As Variant)
G2antt1.BeginUpdate
With G2antt1.Items
.ItemBar(Item, Key, exBarBackColor) = RGB(255, 0, 0)
End With
G2antt1.EndUpdate
End Sub
The following C++ sample displays the new start and end data for the bar being moved or resized:
void OnBarResizeG2antt1(long Item, const VARIANT FAR& Key)
{
CItems items = m_g2antt.GetItems();
COleVariant vtStartDate = items.GetItemBar( Item, Key, /*exBarStart*/1 );
COleVariant vtEndDate = items.GetItemBar( Item, Key, /*exBarEnd*/2 );
OutputDebugString( "newStartDate: " );
OutputDebugString( V2S( &vtStartDate ) );
OutputDebugString( "\n" );
OutputDebugString( "newEndDate: " );
OutputDebugString( V2S( &vtEndDate ) );
OutputDebugString( "\n" );
} The following VB.NET sample displays the new start and end data for the bar being moved or resized:
Private Sub AxG2antt1_BarResize(ByVal sender As Object, ByVal e As AxEXG2ANTTLib._IG2anttEvents_BarResizeEvent) Handles AxG2antt1.BarResize
With AxG2antt1.Items
System.Diagnostics.Debug.Print("newStartDate: " + .ItemBar(e.item, e.key, EXG2ANTTLib.ItemBarPropertyEnum.exBarStart))
System.Diagnostics.Debug.Print("newEndDate: " + .ItemBar(e.item, e.key, EXG2ANTTLib.ItemBarPropertyEnum.exBarEnd))
End With
End Sub The following C# sample displays the new start and end data for the bar being moved or resized:
private void axG2antt1_BarResize(object sender, AxEXG2ANTTLib._IG2anttEvents_BarResizeEvent e)
{
System.Diagnostics.Debug.Print("newStartDate: " + axG2antt1.Items.get_ItemBar(e.item, e.key, EXG2ANTTLib.ItemBarPropertyEnum.exBarStart).ToString());
System.Diagnostics.Debug.Print("newStartDate: " + axG2antt1.Items.get_ItemBar(e.item, e.key, EXG2ANTTLib.ItemBarPropertyEnum.exBarEnd).ToString());
} The following VFP sample displays the new start and end data for the bar being moved or resized:
*** ActiveX Control Event *** LPARAMETERS item, key with thisform.G2antt1.Items ? .ItemBar(item,key,1) ? .ItemBar(item,key,2) endwith