Esempio n. 1
0
        /// <summary>
        /// ページ移動
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnMove_Click(object sender, EventArgs e)
        {
            if (gridChanging || selectedIndex < 0)
            {
                return;
            }

            FormMove form = new FormMove();

            form.MaxValue = pages.Count;
            form.Page     = selectedIndex + 1;
            if (form.ShowDialog() == DialogResult.OK && form.Page != selectedIndex + 1)
            {
                gridChanging = true;

                int move = form.Page - 1;
                if (move < selectedIndex)
                {
                    pages.Insert(move, pages[selectedIndex]);
                    pages.RemoveAt(selectedIndex + 1);
                }
                else
                {
                    pages.Insert(move + 1, pages[selectedIndex]);
                    pages.RemoveAt(selectedIndex);
                }
                selectedIndex = move;

                SetupPagesGrid();
                pagesGrid.ClearSelection();
                pagesGrid.CurrentCell = pagesGrid.Rows[selectedIndex].Cells[2];

                gridChanging = false;
                PageSelectionChanged();

                saved = false;
            }
        }
Esempio n. 2
0
        /// <summary>
        /// ページ移動
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnMove_Click(object sender, EventArgs e)
        {
            if (gridChanging || selectedIndex < 0)
            {
                return;
            }

            FormMove form = new FormMove();
            form.MaxValue = pages.Count;
            form.Page = selectedIndex + 1;
            if (form.ShowDialog() == DialogResult.OK && form.Page != selectedIndex + 1)
            {
                gridChanging = true;

                int move = form.Page - 1;
                if (move < selectedIndex)
                {
                    pages.Insert(move, pages[selectedIndex]);
                    pages.RemoveAt(selectedIndex + 1);
                }
                else
                {
                    pages.Insert(move + 1, pages[selectedIndex]);
                    pages.RemoveAt(selectedIndex);
                }
                selectedIndex = move;

                SetupPagesGrid();
                pagesGrid.ClearSelection();
                pagesGrid.CurrentCell = pagesGrid.Rows[selectedIndex].Cells[2];

                gridChanging = false;
                PageSelectionChanged();

                saved = false;
            }
        }