PlexityHide

Home 

Products 

Downloads 

Our Shop 

Support 

Contact 


Thursday, July 22, 2010

Collision detect of TimeItems in a Gantt chart

The GTP.NET will order the colliding time items in separate sub columns. The way this is done is fully automatic and the  result will be something like this:

image

But what if you would rather to have the Top time item at the bottom?

One way is to re-order the SubColumn values after the collision detection is done. Go like this:

   1: Private _CollisionDetectNeedUpdate As Boolean
   2:  
   3: Private Sub OnCollionsDetect(ByVal aGantt As PlexityHide.GTP.Gantt,
   4:        ByVal e As PlexityHide.GTP.CollisionDetectEventArgs)
   5:     _CollisionDetectNeedUpdate = True
   6: End Sub
   7:  
   8: Private Sub Gantt1_OnTimeItemAreaPaintBackground(ByVal aOffscreenDraw As 
   9:     PlexityHide.GTP.OffscreenDraw, ByVal e As PlexityHide.GTP.OffscreenDrawArgs)
  10:         Handles Gantt1.OnTimeItemAreaPaintBackground
  11:     If (_CollisionDetectNeedUpdate And 
  12:      Gantt1.Grid.RootNodes.Count > 0 And Gantt1.MouseMoveKind = MouseMoveKind.none) Then
  13:         Dim gr As GanttRow = Gantt.GanttRowFromGridNode(Gantt1.Grid.RootNodes(0))
  14:  
  15:         For i = 0 To gr.Layers(0).Count - 1
  16:             gr.Layers(0).Item(i).SubCol = 1 + gr.SubColumnsFromCollisionDetect - 
  17:                gr.Layers(0).Item(i).SubCol
  18:         Next
  19:         _CollisionDetectNeedUpdate = False
  20:     End If
  21:  
  22: End Sub

And then you have a result that looks like this:

image


This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]

Support

Support intro

Knowledgebase

FAQ phGantTimePackage

FAQ GTP.NET

FAQ general

History