VARCHART XGantt is an interactive Gantt chart control, and its modular design allows you to create applications that meet your and your customers needs. (Our leading Gantt controls VARCHART XGantt can be used in .NET, ActiveX and ASP.NET applications.) In addition, also has a stable and reliable Gantt chart tool, before writing the first line of code, you We can know whether to meet customer needs. VARCHART XGantt can be quickly and easily integrated into your applications, helping you to identify performance bottlenecks, avoid delays and efficient use of resources, making it easier to understand complex data.
This paper describes the use of time VARCHART XGantt, some of the common problems encountered, as well as answers to your questions - how to restrict encountered a problem when standard width of it? The problem has ActiveX version and a .NET version of the answer -
How to limit the time scale width? (ActiveX edition)
If you touch the far left of the timescale is visible area while holding down the left mouse button to expand the time scale, it can easily achieve far more than 1000% factor. To control this, please use OnTimeScaleSectionRescale events. The following example shows how best to expand twice.
Sample Code
Private Sub VcGantt1_OnTimeScaleSectionRescale(ByVal timeScale As _ VcGanttLib.VcTimeScale, ByVal sectionIndex As _ Integer, ByVal newBasicUnitWidth As Long, _ returnStatus As Variant) Dim nOldUnitWidth As Long nOldUnitWidth = timeScale.Section(sectionIndex).UnitWidth If newBasicUnitWidth > (2 * nOldUnitWidth) Then timeScale.Section(sectionIndex).UnitWidth = 2 * nOldUnitWidth returnStatus = vcRetStatFalse End If End Sub
How to limit the time scale width? (.NET edition)
If you touch the far left of the timescale is visible area while holding down the left mouse button to expand the time scale, it can easily achieve far more than 1000% factor. To control this, please use VcTimeScaleSectionRescaling events. The following example shows how best to expand twice.
Sample Code VB.NET
Private Sub VcGantt1_VcTimeScaleSectionRescaling(ByVal sender As Object, ByVal e As NETRONIC.XGantt.VcTimeScaleSectionRescalingEventArgs) Handles VcGantt1.VcTimeScaleSectionRescaling Dim nOldUnitWidth As Long Dim returnStatus As VariantType nOldUnitWidth = e.TimeScale.Section(0).UnitWidth If (e.NewBasicUnitWidth > (2 * nOldUnitWidth)) Then nOldUnitWidth = 2 * nOldUnitWidth returnStatus = e.ReturnStatus.vcRetStatFalse End If End Sub
Sample Code C #
private void VcGantt1_VcTimeScaleSectionRescaling(object sender, NETRONIC.XGantt.VcTimeScaleSectionRescalingEventArgs e) { long nOldUnitWidth = e.TimeScale.get_Section(0).UnitWidth; object returnStatus = e.ReturnStatus; if (e.NewBasicUnitWidth > (2 * nOldUnitWidth)) { nOldUnitWidth = 2 * nOldUnitWidth; } }