private void LoadSingleToolStrip() { /* * Update the toolbar menu for single-item operation. */ UI_VIEW_MENU.DropDownOpening += new EventHandler(UI_VIEW_MENU_DropDownOpeningSingle); UI_VIEW_MENU_TOOLBAR.Text = Resources.MainViewMenuToolbarSingle; UI_VIEW_MENU_TOOLBAR.Click += new EventHandler(UI_VIEW_MENU_TOOLBAR_ITEM_Click); UI_VIEW_MENU_TOOLBAR.Tag = Constants.MAIN_TOOLBAR_NAME; /* * Add the main toolbar to the panel. */ DockedToolStrip dockedToolStrip = _dockedToolStrips[Constants.MAIN_TOOLBAR_NAME]; // Make it full width. dockedToolStrip.ToolStrip.Stretch = true; _mainToolStripPanel.Join(dockedToolStrip.ToolStrip); }
/* * Join seems to add in reverse 'column' order so we sort * in reverse to compensate. */ private int CompareByColHint(DockedToolStrip x, DockedToolStrip y) { if (x.ColHint == y.ColHint) { return(0); } else if (x.ColHint < y.ColHint) { return(1); } else { return(-1); } }
/* * Restore a string list representaion of the toolstrip * states to the current toolstrip collection. */ private void DecodeToolStripStatus(List <String> list) { foreach (string item in list) { string[] split = item.Split(':'); if (split.Length != 4) { continue; } if (split[0] == String.Empty) { continue; } int row = 0; int col = 100; try { row = Int32.Parse(split[2]); col = Int32.Parse(split[3]); } catch { // Just accept the defaults. } if (_dockedToolStrips.ContainsKey(split[0])) { /* * We need to keep the toolstrips visible until * all have been restored then set the visibility * according to HideOnRestore. * This is a workaround: toolstips don't restore in * the correct positions if they're not visible. */ DockedToolStrip toolStrip = _dockedToolStrips[split[0]]; toolStrip.Visible = true; toolStrip.HideOnRestore = (split[1] == "0"); toolStrip.RowHint = row; toolStrip.ColHint = col; } } }