PertChart
A PERT chart: a plan's tasks as a network of boxes joined in the order the work has to happen, each box carrying its earliest and latest dates and its float, with the critical path emphasised.
public partial class PertChart : Control
Inherits from / implements: Control
Remarks
Give it the same Tasks and Links as a GanttChart or a TaskBoard and the three show one plan: a change made in either of the others is drawn here at once. Summary tasks are structure, not work, so they are not boxes; a link to or from a summary is drawn to the subtasks at its edges. The chart is for reading. Click or use the arrow keys to select a box, press Enter or double-click to raise TaskActivated, drag the background to pan, use the wheel to scroll (with Shift, sideways) and Ctrl with the wheel, or Ctrl with Plus, Minus and 0, to zoom.
Members at a glance
PertChart | Creates an empty PERT chart. Give it Tasks and Links. |
BoxBackColor | The fill of a box. Empty follows BackColor. |
BoxBorderColor | The border and grid of a box that is not critical. Empty is a shade between BackColor and ForeColor. |
ColumnGap | The space between columns of boxes, in logical units. At least 24. |
ConnectorColor | The arrows between boxes that are not critical. Empty is a shade between BackColor and ForeColor. |
CriticalColor | The border of a critical box and the colour of a critical arrow. |
Holidays | Dates that are not worked. Never null: setting null gives an empty collection. An observable collection is watched. |
Links | The links between tasks. Never null: setting null gives an empty collection. Watched as Tasks is. |
NodeHeight | The height of a box, in logical units. At least 48. |
NodeWidth | The width of a box, in logical units (1/96 inch). At least 80. |
ProgressColor | The bar along the bottom of a box that shows how far the task has got. |
ProjectStart | The first day work can happen. Null uses the earliest planned start in the plan. |
RowGap | The space between rows of boxes, in logical units. At least 8. |
SelectedTask | The task whose box is selected, or null when none is. Setting a task that has no box - a summary, or a task not in the plan - clears the selection. |
ShowCriticalPath | Whether the critical path is drawn in CriticalColor with heavier lines. |
Tasks | The tasks to chart, as a flat list with parent references. Never null: setting null gives an empty collection. |
Today | The date the charts treat as today; null for the computer's date. |
WorkingWeek | The days of the week that are worked. |
ZoomFactor | How large the network is drawn: 1 is its natural size, 0.25 the smallest and 3 the largest. Values outside that range are clamped. |
CreateAccessibilityInstance | Creates the accessible object that presents the boxes to assistive technology. |
Dispose | Stops watching the plan and releases the fonts and the tooltip. |
EnsureSchedule | The plan as last scheduled: every task's dates and float, the critical path, and anything in the input that could not be used. Scheduled again first when something has changed. |
ExportImage | Draws the whole network, at 96 DPI and a zoom of one, into a new image. The selection is not drawn: the image is a record of the plan, not of the screen. |
IsInputKey | Makes the arrows, Home, End and the page keys the chart's own, and Enter while a box is selected, so a dialog's default button keeps Enter otherwise. |
OnDpiChangedAfterParent | Rebuilds everything measured in device pixels when the control moves to a display with a different scale: the fonts, the scroll bars and the scroll range. |
OnFontChanged | Rebuilds the fonts the boxes are written in. |
OnGotFocus | Redraws the focus cue and says which box has the focus. |
OnHandleCreated | Fits the scroll bars once the window exists, when the display's scale is first known for certain. |
OnHandleDestroyed | Forgets a refresh posted to a window that is going away; the next window posts again. |
OnKeyDown | The keys: arrows follow the work (PertLayout), Home and End go to the first and last box, Enter activates, the page keys scroll, and Ctrl with Plus, Minus or 0 zooms. |
OnLostFocus | Removes the focus cue. |
OnMouseCaptureChanged | Ends a pan if the mouse is taken away mid-drag, by a message box or a switch of window. |
OnMouseDoubleClick | A double-click on a box raises TaskActivated. |
OnMouseDown | A press on a box selects it; a press on the background starts a pan. |
OnMouseLeave | Hides the tooltip when the pointer leaves. |
OnMouseMove | Pans while the background is dragged; otherwise keeps the tooltip and cursor on the box under the pointer. |
OnMouseUp | Ends a pan. |
OnMouseWheel | The wheel scrolls, sideways with Shift, and zooms about the pointer with Ctrl. |
OnPaint | Paints the chart. Never throws: a fault is reported and the paint abandoned. |
OnResize | Fits the scroll bars and the view to the new size. |
OnRightToLeftChanged | Lays the network out again, mirrored, when the reading direction changes. |
OnScheduleChanged | Raises ScheduleChanged. |
OnSelectedTaskChanged | Raises SelectedTaskChanged. |
OnTaskActivated | Raises TaskActivated. |
OnZoomFactorChanged | Raises ZoomFactorChanged. |
Reschedule | Schedules the plan again now and raises ScheduleChanged. Needed only after changing a plain list, which cannot be watched. |
ScrollToTask | Scrolls the chart until a task's box is in view. Does nothing for a task that has no box. |
ZoomToFit | Sets ZoomFactor so the whole network fits the control, and scrolls to its start. |
ScheduleChanged | Raised after the plan has been scheduled again because something changed: a task, a link, a collection, a calendar setting, or a call to Reschedule. |
SelectedTaskChanged | Raised when the selected box changes, by the reader or by SelectedTask. |
TaskActivated | Raised when the reader double-clicks a box or presses Enter on the selected one. |
ZoomFactorChanged | Raised when ZoomFactor changes. |
Constructors
PertChart
Creates an empty PERT chart. Give it Tasks and Links.
Properties
BoxBackColor
The fill of a box. Empty follows BackColor.
BoxBorderColor
The border and grid of a box that is not critical. Empty is a shade between BackColor and ForeColor.
ColumnGap
The space between columns of boxes, in logical units. At least 24.
ConnectorColor
The arrows between boxes that are not critical. Empty is a shade between BackColor and ForeColor.
CriticalColor
The border of a critical box and the colour of a critical arrow.
Holidays
Dates that are not worked. Never null: setting null gives an empty collection. An observable collection is watched.
Links
The links between tasks. Never null: setting null gives an empty collection. Watched as Tasks is.
NodeHeight
The height of a box, in logical units. At least 48.
NodeWidth
The width of a box, in logical units (1/96 inch). At least 80.
ProgressColor
The bar along the bottom of a box that shows how far the task has got.
ProjectStart
The first day work can happen. Null uses the earliest planned start in the plan.
RowGap
The space between rows of boxes, in logical units. At least 8.
SelectedTask
The task whose box is selected, or null when none is. Setting a task that has no box - a summary, or a task not in the plan - clears the selection.
ShowCriticalPath
Whether the critical path is drawn in CriticalColor with heavier lines.
Tasks
The tasks to chart, as a flat list with parent references. Never null: setting null gives an empty collection.
ObservableCollection{T} or a BindingList{T} is watched, and so is every task in it, so changes are drawn as they happen. A plain list is read when it is assigned; call Reschedule after changing one.Today
The date the charts treat as today; null for the computer's date.
WorkingWeek
The days of the week that are worked.
ZoomFactor
How large the network is drawn: 1 is its natural size, 0.25 the smallest and 3 the largest. Values outside that range are clamped.
Methods
CreateAccessibilityInstance
Creates the accessible object that presents the boxes to assistive technology.
Returns. The chart's accessible object.
Dispose
Stops watching the plan and releases the fonts and the tooltip.
- disposing
- True when called from
Dispose.
EnsureSchedule
The plan as last scheduled: every task's dates and float, the critical path, and anything in the input that could not be used. Scheduled again first when something has changed.
ExportImage
Draws the whole network, at 96 DPI and a zoom of one, into a new image. The selection is not drawn: the image is a record of the plan, not of the screen.
Returns. The image. The caller disposes it.
Schedule.IsInputKey
Makes the arrows, Home, End and the page keys the chart's own, and Enter while a box is selected, so a dialog's default button keeps Enter otherwise.
- keyData
- The key, with its modifiers.
Returns. True for a key the chart handles.
OnDpiChangedAfterParent
Rebuilds everything measured in device pixels when the control moves to a display with a different scale: the fonts, the scroll bars and the scroll range.
- e
- The event data.
OnFontChanged
Rebuilds the fonts the boxes are written in.
- e
- The event data.
OnGotFocus
Redraws the focus cue and says which box has the focus.
- e
- The event data.
OnHandleCreated
Fits the scroll bars once the window exists, when the display's scale is first known for certain.
- e
- The event data.
OnHandleDestroyed
Forgets a refresh posted to a window that is going away; the next window posts again.
- e
- The event data.
OnKeyDown
The keys: arrows follow the work (PertLayout), Home and End go to the first and last box, Enter activates, the page keys scroll, and Ctrl with Plus, Minus or 0 zooms.
- e
- The key data.
OnLostFocus
Removes the focus cue.
- e
- The event data.
OnMouseCaptureChanged
Ends a pan if the mouse is taken away mid-drag, by a message box or a switch of window.
- e
- The event data.
OnMouseDoubleClick
A double-click on a box raises TaskActivated.
- e
- The mouse data.
OnMouseDown
A press on a box selects it; a press on the background starts a pan.
- e
- The mouse data.
OnMouseLeave
Hides the tooltip when the pointer leaves.
- e
- The event data.
OnMouseMove
Pans while the background is dragged; otherwise keeps the tooltip and cursor on the box under the pointer.
- e
- The mouse data.
OnMouseUp
Ends a pan.
- e
- The mouse data.
OnMouseWheel
The wheel scrolls, sideways with Shift, and zooms about the pointer with Ctrl.
- e
- The mouse data.
OnPaint
Paints the chart. Never throws: a fault is reported and the paint abandoned.
- e
- The paint data.
OnResize
Fits the scroll bars and the view to the new size.
- e
- The event data.
OnRightToLeftChanged
Lays the network out again, mirrored, when the reading direction changes.
- e
- The event data.
OnScheduleChanged
Raises ScheduleChanged.
- e
- The event data.
OnSelectedTaskChanged
Raises SelectedTaskChanged.
- e
- The event data.
OnTaskActivated
Raises TaskActivated.
- e
- The task that was activated.
OnZoomFactorChanged
Raises ZoomFactorChanged.
- e
- The event data.
Reschedule
Schedules the plan again now and raises ScheduleChanged. Needed only after changing a plain list, which cannot be watched.
ScrollToTask
Scrolls the chart until a task's box is in view. Does nothing for a task that has no box.
- task
- The task to show.
ZoomToFit
Sets ZoomFactor so the whole network fits the control, and scrolls to its start.
Events
ScheduleChanged
Raised after the plan has been scheduled again because something changed: a task, a link, a collection, a calendar setting, or a call to Reschedule.
SelectedTaskChanged
Raised when the selected box changes, by the reader or by SelectedTask.
TaskActivated
Raised when the reader double-clicks a box or presses Enter on the selected one.
ZoomFactorChanged
Raised when ZoomFactor changes.