// ---- METHODS (INTERNAL) -------------------------------------------------------------------------------------

        /// <summary>
        /// Shows the input dialog with the given title and value settings.
        /// </summary>
        /// <param name="caption">The text in the title bar of the input box.</param>
        /// <param name="allowFloat"><c>true</c> to allow floating point numbers.</param>
        /// <returns>The value the user entered or <c>null</c> if he canceled.</returns>
        internal static float?Show(string caption, bool allowFloat)
        {
            FormCalculation form = new FormCalculation()
            {
                Text        = caption,
                AllowFloats = allowFloat
            };

            // Set the last default value.
            if (form.AllowFloats)
            {
                form.Value = _lastValue;
            }
            else
            {
                form.Value = (int)_lastValue;
            }

            // Show the dialog and return the value.
            if (form.ShowDialog() == DialogResult.OK)
            {
                _lastValue = form.Value;
                return(form.Value);
            }
            return(null);
        }
        private void Subtract_Clicked(object sender, EventArgs e)
        {
            BinDataGrid binDataGrid = SourceControl as BinDataGrid;
            float?      value       = FormCalculation.Show("Subtract", binDataGrid.DataProvider.UseFloats);

            if (value != null)
            {
                if (binDataGrid.DataProvider.UseFloats)
                {
                    foreach (DataGridViewCell cell in binDataGrid.SelectedCells)
                    {
                        cell.Value = (float)cell.Value - value;
                    }
                }
                else
                {
                    foreach (DataGridViewCell cell in binDataGrid.SelectedCells)
                    {
                        cell.Value = (int)cell.Value - (int)value;
                    }
                }
            }
        }
        private void Divide_Clicked(object sender, EventArgs e)
        {
            BinDataGrid binDataGrid = SourceControl as BinDataGrid;
            float?      value       = FormCalculation.Show("Divide", binDataGrid.DataProvider.UseFloats);

            if (value.HasValue && value != 0)
            {
                if (binDataGrid.DataProvider.UseFloats)
                {
                    foreach (DataGridViewCell cell in binDataGrid.SelectedCells)
                    {
                        cell.Value = (float)cell.Value / value;
                    }
                }
                else
                {
                    foreach (DataGridViewCell cell in binDataGrid.SelectedCells)
                    {
                        cell.Value = (int)cell.Value / (int)value;
                    }
                }
            }
        }