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. |
private void BarResize(object sender,int Item,object Key) { } Private Sub BarResize(ByVal sender As System.Object,ByVal Item As Integer,ByVal Key As Object) Handles BarResize End Sub |
private void BarResize(object sender, AxEXG2ANTTLib._IG2anttEvents_BarResizeEvent e) { } void OnBarResize(long Item,VARIANT Key) { } void __fastcall BarResize(TObject *Sender,Exg2anttlib_tlb::HITEM Item,Variant Key) { } procedure BarResize(ASender: TObject; Item : HITEM;Key : OleVariant); begin end; procedure BarResize(sender: System.Object; e: AxEXG2ANTTLib._IG2anttEvents_BarResizeEvent); begin end; begin event BarResize(long Item,any Key) end event BarResize Private Sub BarResize(ByVal sender As System.Object, ByVal e As AxEXG2ANTTLib._IG2anttEvents_BarResizeEvent) Handles BarResize End Sub Private Sub BarResize(ByVal Item As EXG2ANTTLibCtl.HITEM,ByVal Key As Variant) End Sub Private Sub BarResize(ByVal Item As Long,ByVal Key As Variant) End Sub LPARAMETERS Item,Key PROCEDURE OnBarResize(oG2antt,Item,Key) RETURN |
<SCRIPT EVENT="BarResize(Item,Key)" LANGUAGE="JScript"> </SCRIPT> <SCRIPT LANGUAGE="VBScript"> Function BarResize(Item,Key) End Function </SCRIPT> Procedure OnComBarResize HITEM llItem Variant llKey Forward Send OnComBarResize llItem llKey End_Procedure METHOD OCX_BarResize(Item,Key) CLASS MainDialog RETURN NIL void onEvent_BarResize(int _Item,COMVariant _Key) { } function BarResize as v (Item as OLE::Exontrol.G2antt.1::HITEM,Key as A) end function function nativeObject_BarResize(Item,Key) return |
Calling SchedulePDM method invokes the BarResize event for all affected bars. In conclusion, if using the SchedulePDM method during a BarResize event, you can use a counter to prevent calling the SchedulePDM multiple times, like in the following sample VB:
Dim iSchedulePDM As Long Private Sub G2antt1_BarResize(ByVal Item As EXG2ANTTLibCtl.HITEM, ByVal Key As Variant) If (iSchedulePDM = 0) Then iSchedulePDM = iSchedulePDM + 1 G2antt1.Items.SchedulePDM Item, Key iSchedulePDM = iSchedulePDM - 1 End If End Sub
The following VB sample displays the BarMove message once a a bar is moved (not sizing):
Dim iMoving As Long Private Sub Gantt1_BarResize(ByVal Item As EXG2ANTTLibCtl.HITEM, ByVal Key As Variant) If Not (iMoving = 0) Then Debug.Print "BarMove" End If End Sub Private Sub Gantt1_ChartStartChanging(ByVal Operation As EXG2ANTTLibCtl.BarOperationEnum) If (Operation = exMoveBar) Then iMoving = iMoving + 1 End If End Sub Private Sub Gantt1_ChartEndChanging(ByVal Operation As EXG2ANTTLibCtl.BarOperationEnum) If (Operation = exMoveBar) Then iMoving = iMoving - 1 End If End Sub
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