如何限制甘特图中的时标宽度?

VARCHART XGantt是一个交互式的甘特图控件,其模块化的设计让您可以创建满足您和您的客户所需求的应用程序。(我们领先的甘特图控件VARCHART XGantt可用于.NET,ActiveX和ASP.NET应用程序。)除此之外,同时还具有一个稳定可靠的甘特图工具,在编写第一行代码之前,您就可以知道是否可以满足客户的需求。VARCHART XGantt可以快速、简单地集成到您的应用程序中,帮助您识别性能瓶颈、避免延迟以及高效利用资源,使复杂数据变得更加容易理解。

本文主要介绍了在使用VARCHART XGantt时,遇到的一些常见问题,以及针对问题的回答~您遇到过如何限制时标宽度的问题吗?该问题有ActiveX版.NET版的回答~

如何限制时标宽度? (ActiveX版)

如果在按住鼠标左键的同时触摸可见区域最左端的时间刻度以扩大时间刻度,则可以轻松达到远远超过1000%的因数。若要控制这一点,请使用OnTimeScaleSectionRescale事件。以下示例显示了如何最大程度地扩大两倍。

示例代码

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

如何限制时标宽度?(.NET版)

如果在按住鼠标左键的同时触摸可见区域最左端的时间刻度以扩大时间刻度,则可以轻松达到远远超过1000%的因数。 若要控制这一点,请使用VcTimeScaleSectionRescaling事件。以下示例显示了如何最大程度地扩大两倍。

示例代码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

示例代码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;
 }
 }


猜你喜欢

转载自blog.51cto.com/14467432/2468173