 ---------------------------------------------------
|                                                   |
| Subtotal Manager                                  |
|                                                   |
| iGrid.NET 6.0 Extra Samples                       |
| Copyright (c) 10Tec Company                       |
| All rights reserved                               |
|                                                   |
| Environment: .NET Framework 4.0, VS2010+          |
|                                                   |
 ---------------------------------------------------

Description
===========
This sample provides you with a manager class that automatically calculates subtotals and the grand total for the specified columns in iGrid.NET.


Short Code Explanation
======================
The main functionality is implemented in the iGSubtotalManager class. This class has two public methods: ShowSubtotals and HideSubtotals. These methods show/hide subtotals in the grid specified as their parameter. The public IsSubtotalRow function allows you to determine whether the specified row is a subtotal row created with the manager. You can adjust the colors of subtotal rows with the ForeColor and BackColor properties of the iGSubtotalManager class.

Subtotals can be shown in two different views: in cells and as strings in rows. In the first case subtotal rows are displayed as normal rows with cells filled with subtotal values. In the second case subtotal rows are displayed as merged cells (group rows) and subtotal values are separated by semicolons. The ShowSubtotalsInCells property of the iGSubtotalManager class allows you to specify the view for subtotals.

The ShowSubtotals and HideSubtotals methods also attach and detach event handlers to the grid in order to recreate and adjust subtotal rows automatically when the grid is regrouped or the value of a cell is changed.

The Tag property of every row with subtotals or totals added by iGSubtotalManager is set to the string "TotalRow". This special tag value is used in the IsSubtotalRow function or can be used in your code too.


Usage Guide
===========
All public methods and properties of the iGSubtotalManager class are static (shared in VB.NET). This means there is no need to create an instance of the iGSubtotalManager class to start using it. You just attach the class file to your project, and the class is ready to do its work.

To attach the subtotal manager functionality to a grid, call the ShowSubtotals method of the iGSubtotalManager class. The method expects two parameters: the target grid and the array of indices of columns to calculate subtotals for. For example, the following statement attaches iGSubtotalManager to iGrid1 and displays totals in its fifth, ninth and tenth columns:

iGSubtotalManager.ShowSubtotals(iGrid1, new int[] { 4, 8, 9 });


Change List
===========
[2019-Mar-19]
1. Now iGSubtotalManager ignores the check box column style and does not show the check box in the corresponding cells in subtotal rows.
2. Minor code enhancements.
[2018-Oct-05]
1. Upgraded to the latest iGrid.NET (6.0).
2. The iGSubtotalManager class can use the column formatting specified in its CellStyle.FormatString property.
3. Minor code tweaks.
[2014-Jun-04]
1. Upgraded to the latest iGrid.NET (4.6).
2. Fixed bug when working with dynamic cell contents (the CellDynamicContents event).
3. Fixed bug when the grid is repopulated using the FillWithData method.
4. A constant to change the "Total:" prefix was added.
[2006-Dec-08]
Initial release.
