10588 : Can we make the Today line in real time?

Question

Can we make the Today line update in real time?

Currently I have to move or rescale in the DateTime scaler to get the today line to update. Could this happen in real time?

I have tried using various methods such as Invaildate etc on a timer without success.

Answer

All you need to do is to make sure the TimeItemArea gets invalidated once in a while. Add a timer and in the onTimer event go something like:

gantt1.TimeItemArea.Invalidate();

(for phGantTimePackage you can send an inavlidation message to the handle found here IphGantX3.HWndGantArea)

10199 : vertical line on the time item area, that will always show current time?

Question

Can i draw somehow a vertical line on the time item area, that will always show the current time?

Answer

you can set IphGantX3.TodayLineOnOff=true, but It is easy to do this in the Background draw event, like this

Private Sub phGantX1_OnGantAreaDrawBackground(ByVal theGant As phGantXControl.IphGantX3, ByVal Left As Long, ByVal Top As Long, ByVal Right As Long, ByVal Bottom As Long, ByVal theHDC As Long)
Dim aRect As Module1.RECT

  x = theGant.DateToPixel(Now)
  If (x > 0) And (x < Right) Then
    aRect.Bottom = Bottom
    aRect.Top = Top
    aRect.Right = x + 1
    aRect.Left = x – 1
    aBrush = Module1.GetStockObject(7)
    aDummy = Module1.FrameRect(theHDC, aRect, aBrush)
  End If
‘Public Declare Function GetStockObject Lib “gdi32” (ByVal fnObject As Long) As Long
End Sub

10588 : Can we make the Today line in real time?

Question

Can we make the Today line update in real time?

Currently I have to move or rescale in the DateTime scaler to get the today line to update. Could this happen in real time?

I have tried using various methods such as Invaildate etc on a timer without success.

Answer

All you need to do is to make sure the TimeItemArea gets invalidated once in a while. Add a timer and in the onTimer event go something like:

gantt1.TimeItemArea.Invalidate();

(for phGantTimePackage you can send an inavlidation message to the handle found here IphGantX3.HWndGantArea)