HomeProductsSupportDownloadsOnline StoreOnLine DocumentationLicensingAbout UsContact Us

Need technical support or assistance?

Click Here.

Please remember to read our guidelines first.

 

 

You will receive advance information about products and web updates as well as free software and source code that we will soon make available.

Subscribe Now

Once your subscription is activated you will receive instructions on how to leave the list.

 
     
Hundreds of free Visual Basic source code snippets, activeX controls, tutorials, tips, projects and articles covering VB.NET and VB6! Great code on topics like MAPI, winsock programming, COM, MTS, XML, graphics, threading, timers, networking, API's and more!
Welcome to the largest single directory of ASP.NET resources. This free directory links to examples, articles, and tutorials. A searchable code library allows you to find scripts. A daily newsletter keeps you up to date on the latest submissions.
Search the best developer Web sites and hundreds of developer newsgroups... updated every thirty minutes!

TN00001 - Using Layers in the ActiveGantt Scheduler Component

Applies to:
  • ActiveGantt Scheduler Component for Visual Basic 6.0
  • ActiveGantt Scheduler Component for Visual Studio .Net (Windows Forms Control - VB.Net)
  • ActiveGantt Scheduler Component for ASP.Net (Web Server Control - VB.Net)
  • ActiveGantt Scheduler Component for Visual C++ 6.0 (MFC ActiveX Control)
Summary:

It is sometimes desirable to arrange more than one group of GanttItems or Milestones in a single Row object like in the following example:

The layout is a typical project management application where the planned times are in black vs. the actual times which are in red. The ActiveGantt component does not allow GanttItems or Milestones to overlap. This is where the Layer object steps in. A layer object acts as container for GanttItem and Milestone objects. Layer objects can be made visible or invisible. GanttItems and Milestones within a same layer object cannot be in conflict, but they can be in conflict with other Milestones and GanttItems as long as they are associated with different layer objects. Layers are an adoption of the same type of object found in many popular drawing applications.

The default layer cannot be edited (i.e. it cannot be made invisible), and GanttItems and Milestones added by default are always placed in the default layer. Another important thing to note is that Layers do not control the appearance of GanttItems and Milestones, only the associated Style object for each GanttItem or Milestone can control visual appearance and placement.

Creating the above example is a relatively straightforward process. In Visual Basic 6.0 open a New Standard .EXE project. Go to Project -> Components and add the ActiveGantt control.

Open Form1 and place an instance of the ActiveGantt Scheduler Component. In the Form_Load() sub place the following code:


Private Sub Form_Load()
    Dim lIndex As Long
    With ActiveGanttVBCtl1
        .AutomaticRedraw = False
        .ZoomFactor = 13
        .RowHeight = 40
        .AllowRowSize = False
        With .Styles
            .Add "Title"
            .Item("Title").CaptionAlignmentHorizontal = HA_LEFT
            .Item("Title").CaptionXMargin = 5
            .Item("Title").Font.Bold = True
            .Add "Task"
            .Item("Task").CaptionAlignmentHorizontal = HA_LEFT
            .Item("Task").CaptionXMargin = 25
            .Item("Task").Font.Size = 7
            .Item("Task").BorderStyle = SB_NONE
            .Item("Task").Appearance = SA_CELL
            .Item("Task").BackColor = &H80000005
            .Item("Task").BorderColor = ActiveGanttVBCtl1.GridLinesColor
            .Add "RowHeadings"
            .Item("RowHeadings").CaptionAlignmentVertical = VA_BOTTOM
            .Item("RowHeadings").CaptionYMargin = 5
            .Item("RowHeadings").Font.Bold = True
            .Add "Projected"
            .Item("Projected").Appearance = SA_FLAT
            .Item("Projected").Placement = PLC_OFFSETPLACEMENT
            .Item("Projected").OffsetTop = 2
            .Item("Projected").OffsetBottom = 10
            .Item("Projected").StartShapeIndex = 1
            .Item("Projected").EndShapeIndex = 1
            .Item("Projected").BorderColor = RGB(0, 0, 0)
            .Item("Projected").BackColor = RGB(0, 0, 0)
            .Item("Projected").BorderStyle = SB_SINGLE
            .Item("Projected").BackgroundPattern = FP_DOWNWARDDIAGONAL
            .Add "Actual"
            .Item("Actual").Appearance = SA_FLAT
            .Item("Actual").Placement = PLC_OFFSETPLACEMENT
            .Item("Actual").OffsetTop = 25
            .Item("Actual").OffsetBottom = 10
            .Item("Actual").StartShapeIndex = 1
            .Item("Actual").EndShapeIndex = 1
            .Item("Actual").BorderColor = RGB(255, 0, 0)
            .Item("Actual").BackColor = RGB(255, 0, 0)
            .Item("Actual").StartFillColor = RGB(255, 0, 0)
            .Item("Actual").EndFillColor = RGB(255, 0, 0)
            .Item("Actual").StartBorderColor = RGB(255, 0, 0)
            .Item("Actual").EndBorderColor = RGB(255, 0, 0)
            .Item("Actual").BorderStyle = SB_SINGLE
            .Item("Actual").BackgroundPattern = FP_DIAGONALCROSS
        End With
        With .RowHeadings
            .Item(1).Caption = "ID"
            .Item(1).Width = 25
            .Item(1).StyleIndex = "RowHeadings"
            .Add ""
            .Item(2).Width = 30
            .Item(2).StyleIndex = "RowHeadings"
            .Add "Task Name"
            .Item(3).Width = 200
            .Item(3).StyleIndex = "RowHeadings"
        End With
        With .Rows
            .Add "K1"
            .Item("K1").RowValue(3).Caption = "Legacy Systems Integration"
            .Item("K1").RowValue(3).StyleIndex = "Title"
            .Add "K2"
            .Item("K2").RowValue(3).Caption = "Implement CGS"
            .Item("K2").RowValue(3).StyleIndex = "Title"
            .Item("K2").GanttItemContainer = False
            .Add "K3"
            .Item("K3").RowValue(3).Caption = "Implement Customers/Contact/Leads"
            .Add "K4"
            .Item("K4").RowValue(3).Caption = "Analyse " & _
             "Strategy for Completing CGS Implementation"
            .Add "K5"
            .Item("K5").RowValue(3).Caption = "Implement Customer Financials"
            .Add "K6"
            .Item("K6").RowValue(3).Caption = "Implement CRM"
            .Add "K7"
            .Item("K7").RowValue(3).Caption = "Implement Financials"
            .Add "K8"
            .Item("K8").RowValue(3).Caption = "Implement Customer Records"
            .Add "K9"
            .Item("K9").RowValue(3).Caption = "Advanced CRM Pilot"
            .Add "K10"
            .Item("K10").RowValue(3).Caption = "Implement EDI"
            .Item("K10").RowValue(3).StyleIndex = "Title"
            .Item("K10").GanttItemContainer = False
            .Add "K11"
            .Item("K11").RowValue(3).Caption = "Electronic Documents"
            .Add "K12"
            .Item("K12").RowValue(3).Caption = "Analyse " & _
            "Strategy for Completing EDI Implementation"
            .Add "K13"
            .Item("K13").RowValue(3).Caption = "Implement Payroll/401 K"
            .Add "K14"
            .Item("K14").RowValue(3).Caption = "Procurement"
            .Add "K15"
            .Item("K15").RowValue(3).Caption = "Implement Administration"
            .Add "K16"
            .Item("K16").RowValue(3).Caption = "RATTLE Tracking"
            .Add "K17"
            .Item("K17").RowValue(3).Caption = "Implement Employee Health and Safety"
            .Add "K18"
            .Item("K18").RowValue(3).Caption = "Implement Planning"
            .Add "K19"
            .Item("K19").RowValue(3).Caption = "Implement Remaining Records"
            .Add "K20"
            .Item("K20").RowValue(3).Caption = "System Environment"
            .Item("K20").RowValue(3).StyleIndex = "Title"
            .Item("K20").GanttItemContainer = False
            .Add "K21"
            .Item("K21").RowValue(3).Caption = "Initial Management Support System"
            .Add "K22"
            .Item("K22").RowValue(3).Caption = "Initial Self " & _ 
            "Service and Support System"
            .Add "K23"
            .Item("K23").RowValue(3).Caption = "Complete Management " & _ 
            "Support System"
            .Add "K24"
            .Item("K24").RowValue(3).Caption = "Complete Self Service " & _ 
            "and Support System"
            .Add "K25"
            .Item("K25").RowValue(3).Caption = "User Support and Documentation"
            .Item("K25").RowValue(3).StyleIndex = "Title"
            .Add "K26"
            .Item("K26").RowValue(3).Caption = "Systems Infrastructure"
            .Item("K26").RowValue(3).StyleIndex = "Title"
            For lIndex = 1 To .Count
                .Item("K" & lIndex).RowValue(1).Caption = lIndex
                If .Item("K" & lIndex).RowValue(3).StyleIndex = "0" Then
                    .Item("K" & lIndex).RowValue(3).StyleIndex = "Task"
                End If
            Next lIndex
        End With
        With .Layers
            .Add "Layer1"
            .Add "Layer2"
        End With
        With .GanttItems
            .Add "", "K1", "01/01/2003", "04/01/2003", , "Projected", , "Layer1"
            .Add "", "K1", "01/05/2003", "04/10/2003", , "Actual", , "Layer2"
    
            .Add "", "K1", "04/15/2003", "08/01/2003", , "Projected", , "Layer1"
            .Add "", "K1", "04/17/2003", "08/20/2003", , "Actual", , "Layer2"
            
            .Add "", "K3", "01/01/2003", "02/01/2003", , "Projected", , "Layer1"
            .Add "", "K3", "01/09/2003", "02/20/2003", , "Actual", , "Layer2"
            
            .Add "", "K4", "01/01/2003", "02/15/2003", , "Projected", , "Layer1"
            .Add "", "K4", "01/08/2003", "02/25/2003", , "Actual", , "Layer2"
            
            .Add "", "K5", "02/15/2003", "07/01/2003", , "Projected", , "Layer1"
            .Add "", "K5", "02/18/2003", "07/11/2003", , "Actual", , "Layer2"
            
            .Add "", "K6", "02/15/2003", "07/01/2003", , "Projected", , "Layer1"
            .Add "", "K6", "02/17/2003", "07/23/2003", , "Actual", , "Layer2"
            
            .Add "", "K7", "02/15/2003", "07/01/2003", , "Projected", , "Layer1"
            .Add "", "K7", "02/16/2003", "07/10/2003", , "Actual", , "Layer2"
            
            .Add "", "K8", "02/15/2003", "07/01/2003", , "Projected", , "Layer1"
            .Add "", "K8", "02/16/2003", "07/08/2003", , "Actual", , "Layer2"
            
            .Add "", "K9", "05/01/2003", "07/01/2003", , "Projected", , "Layer1"
            .Add "", "K9", "05/05/2003", "07/11/2003", , "Actual", , "Layer2"
            
            .Add "", "K11", "02/01/2003", "03/11/2003", , "Projected", , "Layer1"
            .Add "", "K11", "02/07/2003", "03/13/2003", , "Actual", , "Layer2"
            
            .Add "", "K12", "02/15/2003", "03/20/2003", , "Projected", , "Layer1"
            .Add "", "K12", "02/12/2003", "03/19/2003", , "Actual", , "Layer2"
            
            .Add "", "K13", "03/20/2003", "07/15/2003", , "Projected", , "Layer1"
            .Add "", "K13", "03/21/2003", "07/16/2003", , "Actual", , "Layer2"
            
            .Add "", "K14", "03/20/2003", "07/5/2003", , "Projected", , "Layer1"
            .Add "", "K14", "03/22/2003", "07/5/2003", , "Actual", , "Layer2"
            
            .Add "", "K15", "03/20/2003", "06/25/2003", , "Projected", , "Layer1"
            .Add "", "K15", "03/25/2003", "06/25/2003", , "Actual", , "Layer2"
            
            .Add "", "K16", "03/20/2003", "05/01/2003", , "Projected", , "Layer1"
            .Add "", "K16", "03/22/2003", "05/05/2003", , "Actual", , "Layer2"
            
            .Add "", "K17", "03/20/2003", "05/01/2003", , "Projected", , "Layer1"
            .Add "", "K17", "03/24/2003", "05/05/2003", , "Actual", , "Layer2"
            
            .Add "", "K18", "03/20/2003", "05/01/2003", , "Projected", , "Layer1"
            .Add "", "K18", "03/24/2003", "05/09/2003", , "Actual", , "Layer2"
            
            .Add "", "K19", "03/20/2003", "05/01/2003", , "Projected", , "Layer1"
            .Add "", "K19", "03/25/2003", "05/05/2003", , "Actual", , "Layer2"
            
            .Add "", "K16", "05/07/2003", "07/15/2003", , "Projected", , "Layer1"
            .Add "", "K16", "05/20/2003", "07/20/2003", , "Actual", , "Layer2"
            
            .Add "", "K17", "05/08/2003", "07/15/2003", , "Projected", , "Layer1"
            .Add "", "K17", "05/20/2003", "07/17/2003", , "Actual", , "Layer2"
            
            .Add "", "K18", "05/10/2003", "07/15/2003", , "Projected", , "Layer1"
            .Add "", "K18", "05/20/2003", "07/12/2003", , "Actual", , "Layer2"
            
            .Add "", "K19", "05/15/2003", "07/15/2003", , "Projected", , "Layer1"
            .Add "", "K19", "05/16/2003", "07/18/2003", , "Actual", , "Layer2"
            
            .Add "", "K21", "12/01/2002", "04/01/2003", , "Projected", , "Layer1"
            .Add "", "K21", "12/20/2002", "04/04/2003", , "Actual", , "Layer2"
            
            .Add "", "K22", "12/01/2002", "03/20/2003", , "Projected", , "Layer1"
            .Add "", "K22", "12/03/2002", "03/24/2003", , "Actual", , "Layer2"
            
            .Add "", "K23", "05/01/2003", "08/01/2003", , "Projected", , "Layer1"
            .Add "", "K23", "05/10/2003", "08/07/2003", , "Actual", , "Layer2"
            
            .Add "", "K24", "06/01/2003", "08/01/2003", , "Projected", , "Layer1"
            .Add "", "K24", "06/08/2003", "08/25/2003", , "Actual", , "Layer2"
            
            .Add "", "K25", "01/01/2003", "08/01/2003", , "Projected", , "Layer1"
            .Add "", "K25", "01/05/2003", "08/20/2003", , "Actual", , "Layer2"
            
            .Add "", "K26", "01/01/2003", "07/05/2003", , "Projected", , "Layer1"
            .Add "", "K26", "01/03/2003", "07/07/2003", , "Actual", , "Layer2"
            
        End With
        .FixedColumnWidth = 255
        .AutomaticRedraw = True
        .PositionTimeLine "12/01/2002" '// This method redraws the screen
    End With
End Sub

As you can see from this example, layers are first created and then GanttItems are assigned to each Layer as they are being Added. GanttItems and Milestones can be switched from any layer by simply changing their LayerIndex property. For positioning and appearance two Style objects have been created, they rely on Offset placement for positioning within the Row object and this way we can avoid visual overlapping.

Home | Products | Support | Downloads | OnLine Store

Online Documentation | Licensing | About Us | Contact Us

Privacy Terms of use Copyright (c)2002-2004 Source Code Store. All trademarks are property of their legal owner.