コード例 #1
0
        private void LoadBookmarks()
        {
            panelContent.Controls.Clear();
            SelectedBookmark = null;

            foreach (var bm in BookmarkStorage.Instance.bookmarks)
            {
                var ctrl = new BookmarkControl
                {
                    Bookmark         = bm,
                    ImageList        = imgList,
                    Parent           = panelContent,
                    AllowDrop        = true,
                    ContextMenuStrip = contextMenu
                };
                ctrl.DragEnter += CellDragEnter;
                ctrl.DragDrop  += CellDragDrop;
                ctrl.DragOver  += CellDragOver;
                ctrl.MouseDown += CellMouseDown;
                ctrl.Clicked   += CtrlOnClicked;
                ctrl.DragLeave += CellDragLeave;

                ctrl.CloseClicked += CtrlOnCloseClicked;
                ctrl.CalculateSize();
                panelContent.Controls.Add(ctrl);
            }

            ArrangeBookmarks(false);
            // выделить первую закладку
            SelectedBookmark = ((BookmarkControl)panelContent.Controls[0]).Bookmark;
        }
コード例 #2
0
        private BookmarkControl AddBookmarkControl(TerminalBookmark bm, int left)
        {
            var btn = new BookmarkControl
            {
                Bookmark  = bm,
                ImageList = ImgList,
                Parent    = this,
                Left      = left,
                ModeEdit  = false
            };

            btn.Click += BtnOnClick;
            btn.CalculateSize();
            Controls.Add(btn);
            return(btn);
        }
コード例 #3
0
        private void GoOnBookmark(BookmarkControl entering)
        {
            var leaving = (BookmarkControl)Controls[1];

            // перерисовать контролы
            for (var i = 1; i < Controls.Count; i++)
            {
                var btn        = (BookmarkControl)Controls[i];
                var isSelected = btn == entering;
                if (btn.Selected != isSelected)
                {
                    btn.Selected = isSelected;
                    if (!btn.Selected)
                    {
                        leaving = btn;
                    }
                    btn.Invalidate();
                }
            }

            // перейти на "вкладку"
            selectedTabChanged(leaving.Bookmark, entering.Bookmark);
        }
コード例 #4
0
        private void GoOnBookmark(BookmarkControl entering)
        {
            var leaving = (BookmarkControl)Controls[1];

            // перерисовать контролы
            for (var i = 1; i < Controls.Count; i++)
            {
                var btn = (BookmarkControl)Controls[i];
                var isSelected = btn == entering;
                if (btn.Selected != isSelected)
                {
                    btn.Selected = isSelected;
                    if (!btn.Selected)
                        leaving = btn;
                    btn.Invalidate();
                }
            }

            // перейти на "вкладку"
            selectedTabChanged(leaving.Bookmark, entering.Bookmark);
        }
コード例 #5
0
 private BookmarkControl AddBookmarkControl(TerminalBookmark bm, int left)
 {
     var btn = new BookmarkControl
         {
             Bookmark = bm,
             ImageList = ImgList,
             Parent = this,
             Left = left,
             ModeEdit = false
         };
     btn.Click += BtnOnClick;
     btn.CalculateSize();
     Controls.Add(btn);
     return btn;
 }
コード例 #6
0
ファイル: BookmarkForm.cs プロジェクト: johnmensen/TradeSharp
        private void LoadBookmarks()
        {
            panelContent.Controls.Clear();
            SelectedBookmark = null;

            foreach (var bm in BookmarkStorage.Instance.bookmarks)
            {
                var ctrl = new BookmarkControl
                    {
                        Bookmark = bm,
                        ImageList = imgList,
                        Parent = panelContent,
                        AllowDrop = true,
                        ContextMenuStrip = contextMenu
                    };
                ctrl.DragEnter += CellDragEnter;
                ctrl.DragDrop += CellDragDrop;
                ctrl.DragOver += CellDragOver;
                ctrl.MouseDown += CellMouseDown;
                ctrl.Clicked += CtrlOnClicked;
                ctrl.DragLeave += CellDragLeave;

                ctrl.CloseClicked += CtrlOnCloseClicked;
                ctrl.CalculateSize();
                panelContent.Controls.Add(ctrl);
            }

            ArrangeBookmarks(false);
            // выделить первую закладку
            SelectedBookmark = ((BookmarkControl)panelContent.Controls[0]).Bookmark;
        }