作成日: 2020/10/20 最終更新日: 2020/10/20
文書種別
使用方法
詳細
子タスクを持つ親タスクを多数追加し、すべての子タスクを展開したり折りたたんだりすると、スクロールバーのつまみがちらつくことがあります。
本コントロールには、パフォーマンスを改善するためにBeginUpdate/EndUpdateメソッドが用意されていますので、展開または折りたたみの前後にこれらのメソッドを実行することで、ちらつきを抑えることができます。
◎サンプルコード(VB)
本コントロールには、パフォーマンスを改善するためにBeginUpdate/EndUpdateメソッドが用意されていますので、展開または折りたたみの前後にこれらのメソッドを実行することで、ちらつきを抑えることができます。
◎サンプルコード(VB)
Imports C1.GanttView
Imports C1.Win.C1GanttView
Public Class Form1
Dim t, task As Task
Dim nTasks As Integer = 1000
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
C1GanttView1.Tasks.Clear()
Dim prj As Task = Nothing
C1GanttView1.BeginUpdate()
' タスクを追加します
For i As Int32 = 0 To nTasks - 1
t = New Task()
t.Name = "Task" & i
t.Mode = TaskMode.Manual
t.Start = DateTime.Today.AddDays(i)
t.DurationUnits = DurationUnits.Days
t.Duration = 2
C1GanttView1.Tasks.Add(t)
If i Mod 10 = 0 Then
prj = t
C1GanttView1.ProjectSummary.AddChild(prj)
Else
prj.AddChild(t)
End If
Next
C1GanttView1.EndUpdate()
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
C1GanttView1.BeginUpdate()
' 子タスクを折りたたみます
For Each tt As Task In C1GanttView1.Tasks
If tt.OutlineLevel = 1 Then
tt.IsCollapsed = True
End If
Next
C1GanttView1.EndUpdate()
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
C1GanttView1.BeginUpdate()
' 子タスクを展開します
For Each tt As Task In C1GanttView1.Tasks
If tt.OutlineLevel = 1 Then
tt.IsCollapsed = False
End If
Next
C1GanttView1.EndUpdate()
End Sub
End Class
◎サンプルコード(C#)using C1.GanttView;
using C1.Win.C1GanttView;
namespace prj_C1GanttView
{
public partial class Form1 : Form
{
C1.Win.C1GanttView.Task t;
int nTasks = 1000;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
c1GanttView1.Tasks.Clear();
C1.Win.C1GanttView.Task prj = null;
c1GanttView1.BeginUpdate();
// タスクを追加します
for (Int32 i = 0; i < nTasks; i++)
{
t = new C1.Win.C1GanttView.Task();
t.Name = ("Task" + i);
t.Mode = TaskMode.Manual;
t.Start = DateTime.Today.AddDays(i);
t.DurationUnits = DurationUnits.Days;
t.Duration = 2;
c1GanttView1.Tasks.Add(t);
if (i % 10 == 0)
{
prj = t;
c1GanttView1.ProjectSummary.AddChild(prj);
}
else
{
prj.AddChild(t);
}
}
c1GanttView1.EndUpdate();
}
private void Button1_Click(object sender, EventArgs e)
{
c1GanttView1.BeginUpdate();
// 子タスクを折りたたみます
foreach (C1.Win.C1GanttView.Task tt in c1GanttView1.Tasks)
{
if ((tt.OutlineLevel == 1))
{
tt.IsCollapsed = true;
}
}
c1GanttView1.EndUpdate();
}
private void Button2_Click(object sender, EventArgs e)
{
c1GanttView1.BeginUpdate();
// 子タスクを展開します
foreach (C1.Win.C1GanttView.Task tt in c1GanttView1.Tasks)
{
if ((tt.OutlineLevel == 1))
{
tt.IsCollapsed = false;
}
}
c1GanttView1.EndUpdate();
}
}
}
旧文書番号
86104