private void PageDragStart(Point pt)
        {
            if (DragPageNotify != null)
            {
                // Create a page that will be dragged
                _dragPage = new KryptonPage();
                _dragPage.Text = _dragNode.Text;
                _dragPage.TextTitle = _dragNode.Text + " Title";
                _dragPage.TextDescription = _dragNode.Text + " Description";
                _dragPage.ImageSmall = ImageList.Images[int.Parse((string)_dragNode.Tag)];
                _dragPage.Tag = _dragNode.Tag;

                // Create a rich text box with some sample text inside
                KryptonRichTextBox rtb = new KryptonRichTextBox();
                rtb.Text = "This page (" + _dragPage.Text + ") contains a rich text box control as example content.";
                rtb.Dock = DockStyle.Fill;
                rtb.StateCommon.Border.Draw = InheritBool.False;

                // Add rich text box as the contents of the page
                _dragPage.Padding = new Padding(5);
                _dragPage.Controls.Add(rtb);

                // Give the notify interface a chance to reject the attempt to drag
                PageDragCancelEventArgs de = new PageDragCancelEventArgs(PointToScreen(pt), Point.Empty, this, new KryptonPage[] { _dragPage });
                DragPageNotify.PageDragStart(this, null, de);

                if (de.Cancel)
                {
                    // No longer need the temporary drag page
                    _dragPage.Dispose();
                    _dragPage = null;
                }
                else
                {
                    _dragging = true;
                    Capture = true;
                }
            }
        }
Example #2
0
        private bool CloseMemoPage(KryptonPage page)
        {
            // We must have a page to actually close
            if (page != null)
            {
                // If the page is dirty then we need to ask if it should be saved
                if (page.Text.EndsWith("*"))
                {
                    switch(MessageBox.Show("Do you want to save changes to '" + page.Text.TrimEnd('*') + "' ?",
                                           "Memo Editor", MessageBoxButtons.YesNoCancel))
                    {
                        case DialogResult.Cancel:
                            // Returning true indicates the operation was cancelled
                            return true;
                        case DialogResult.Yes:
                            SaveMemoPage(page);
                            break;
                        case DialogResult.No:
                            break;
                    }
                }

                // Remove the page from the containing cell
                KryptonWorkspaceCell cell = kryptonWorkspace.CellForPage(page);
                cell.Pages.Remove(page);
                page.Dispose();

                UpdateApplicationTitle();
                UpdateOptions();
            }

            // Returning false indicates the operation was not cancelled
            return false;
        }