Exemplo n.º 1
0
 void ResourceContainer_Scroll(object sender, ScrollEventArgs e)
 {
     ResourceNamePanel.Top = ResourcePanel.Top;
     TaskPanel.Left        = ResourcePanel.Left;
     if (e.ScrollOrientation == ScrollOrientation.HorizontalScroll)
     {
         TimePanel.Refresh();
     }
     ShowScrollBar(TaskContainer.Handle, (int)ScrollBarDirection.SB_HORZ, false);
 }
Exemplo n.º 2
0
        void RefreshState()
        {
            if (tasks == null || resources == null)
            {
                return;
            }
            GetTimeUnit(out MinorTimeUnit, out TimeUnitCountPerMajorUnit);
            int width = 0;

            for (int i = 0; i < tasks.Length; i++)
            {
                width = Math.Max(width, (int)((tasks[i].PlannedDuration + tasks[i].PlannedStart) * ScaleFactor));
            }
            int rowCount = tasks.Length + 1;

            width = width + 200;
            width = Math.Max(width, TaskContainer.Width);

            int height = TimeRowHeight + rowCount * RowHeight;

            height         = Math.Max(height, TaskContainer.Height);
            TaskPanel.Size = new Size(width, height);

            TaskNamePanel.Size = new Size(
                Math.Max(nameColumnWidth, TaskNamePanel.Width),
                Math.Max(RowHeight * tasks.Length + TimeRowHeight, TaskNamePanel.Height));

            rowCount = 0;
            for (int i = 0; i < resources.Length; i++)
            {
                rowCount += resources[i].Count;
            }
            ResourceNamePanel.Size = new Size(
                Math.Max(nameColumnWidth, ResourceNamePanel.Width),
                Math.Max(RowHeight * rowCount, ResourceNamePanel.Height));
            width              = Math.Max(width, ResourceContainer.Width);
            height             = Math.Max(RowHeight * rowCount, ResourceContainer.Height);
            ResourcePanel.Size = new Size(
                width,
                height);

            TaskContainer.HorizontalScroll.Enabled = false;
            TaskContainer.HorizontalScroll.Visible = false;

            LeftContainer.Width = nameColumnWidth;

            TaskPanel.Refresh();
            TaskNamePanel.Refresh();
            ResourceNamePanel.Refresh();
            ResourcePanel.Refresh();
            TimePanel.Refresh();
            ShowScrollBar(TaskContainer.Handle, (int)ScrollBarDirection.SB_HORZ, false);
        }