Exemplo n.º 1
0
        private void ActMoveUp_Click(System.Object sender, System.EventArgs e)
        {
            // ----- Move the selected column up one position.
            Object content;
            bool   selection;
            int    startIndex;

            // ----- Identify the base item to move.
            startIndex = IncludedColumns.SelectedIndex;
            if (startIndex <= 0)
            {
                return;
            }

            // ----- Move the content.
            content = IncludedColumns.Items[startIndex];
            IncludedColumns.Items[startIndex]     = IncludedColumns.Items[startIndex - 1];
            IncludedColumns.Items[startIndex - 1] = content;

            // ----- Move the inclusion marker.
            selection = IncludedColumns.GetItemChecked(startIndex);
            IncludedColumns.SetItemChecked(startIndex,
                                           IncludedColumns.GetItemChecked(startIndex - 1));
            IncludedColumns.SetItemChecked(startIndex - 1, selection);

            // ----- Move to the new position.
            IncludedColumns.SelectedIndex = startIndex - 1;
        }