

| Type | Description |
private void DateChange(object sender)
{
}
Private Sub DateChange(ByVal sender As System.Object) Handles DateChange End Sub |
private void DateChange(object sender, EventArgs e)
{
}
void OnDateChange()
{
}
void __fastcall DateChange(TObject *Sender)
{
}
procedure DateChange(ASender: TObject; ); begin end; procedure DateChange(sender: System.Object; e: System.EventArgs); begin end; begin event DateChange() end event DateChange Private Sub DateChange(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateChange End Sub Private Sub DateChange() End Sub Private Sub DateChange() End Sub LPARAMETERS nop PROCEDURE OnDateChange(oG2antt) RETURN |
<SCRIPT EVENT="DateChange()" LANGUAGE="JScript"> </SCRIPT> <SCRIPT LANGUAGE="VBScript"> Function DateChange() End Function </SCRIPT> Procedure OnComDateChange Forward Send OnComDateChange End_Procedure METHOD OCX_DateChange() CLASS MainDialog RETURN NIL void onEvent_DateChange()
{
}
function DateChange as v () end function function nativeObject_DateChange() return |
The following VB sample displays the first visible date when the user changes the first visible date:
Private Sub G2antt1_DateChange()
With G2antt1.Chart
Debug.Print FormatDateTime(.FirstVisibleDate)
End With
End Sub
The following VB sample limits the scrolling area of the chart from 1/1/2005 to 31/12/2005:
Private Function LastVisibleDate(ByVal g As EXG2ANTTLibCtl.G2antt) As Date
With G2antt1
With .Chart
Dim d As Date
d = .FirstVisibleDate
Do While .IsDateVisible(d)
d = .NextDate(d, exDay, 1)
Loop
End With
End With
LastVisibleDate = d - 1
End Function
Private Sub G2antt1_DateChange()
Dim dMin As Date, dMax As Date
dMin = "1/1/2005"
dMax = "31/12/2005"
With G2antt1.Chart
If .FirstVisibleDate < dMin Then
.FirstVisibleDate = dMin
End If
If LastVisibleDate(G2antt1) > dMax Then
.FirstVisibleDate = dMax - (LastVisibleDate(G2antt1) - .FirstVisibleDate) + 1
End If
End With
End Sub
or you can use the FormatDate method like follows:
Private Sub G2antt1_DateChange()
With G2antt1.Chart
Debug.Print .FormatDate(.FirstVisibleDate, "<%yyyy%>-<%m%>-<%d%>")
End With
End Sub
The following C++ sample displays the first visible date when the user changes the first visible date:
#include "G2antt.h"
#include "Chart.h"
static DATE V2D( VARIANT* pvtDate )
{
COleVariant vtDate;
vtDate.ChangeType( VT_DATE, pvtDate );
return V_DATE( &vtDate );
}
void OnDateChangeG2antt1()
{
if ( m_g2antt.GetControlUnknown() )
{
CChart chart = m_g2antt.GetChart();
TCHAR szDate[1024] = _T("");
SYSTEMTIME stDate = {0};
VariantTimeToSystemTime( V2D( &chart.GetFirstVisibleDate() ), &stDate );
GetDateFormat( LOCALE_SYSTEM_DEFAULT, LOCALE_USE_CP_ACP, &stDate, NULL, szDate, 1024 );
OutputDebugString( szDate );
}
}
The following VB.NET sample displays the first visible date when the user changes the first visible date:
Private Sub AxG2antt1_DateChange(ByVal sender As Object, ByVal e As System.EventArgs) Handles AxG2antt1.DateChange
Debug.Write(AxG2antt1.Chart.FirstVisibleDate.ToString())
End Sub
The following C# sample displays the first visible date when the user changes the first visible date:
private void axG2antt1_DateChange(object sender, EventArgs e)
{
System.Diagnostics.Debug.Write(axG2antt1.Chart.FirstVisibleDate.ToString());
}
The following VFP sample displays the first visible date when the user changes the first visible date:
*** ActiveX Control Event *** with thisform.G2antt1.Chart wait window nowait .FormatDate(.FirstVisibleDate, "<%yyyy%>-<%m%>-<%d%>") endwith