event BarResize (Item as HITEM, Key as Variant)
Occurs when the bar is moved or resized.

 TypeDescription 
   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 BarResize event notifies your application that the user resizes or moves a bar. Also, the BarResize event is fired when the user changes the percent value. Use the ItemBar property to retrieve the exBarStart and exBarEnd properties of the bar being changed. The exBarPercent value specifies the value of the percent. Use the CellValue property to change the cell's value. The BarParentChange event notifies your application when a bar is about to be moved from an item to another item.

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

 


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