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; }
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); }
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); }
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); }
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; }