Example #1
0
            public SettingsStub(ToolStrip toolStrip)
            {
                this.ToolStripPanelName = string.Empty;
                ToolStripPanel parent = toolStrip.Parent as ToolStripPanel;

                if (parent != null)
                {
                    if (!string.IsNullOrEmpty(parent.Name))
                    {
                        this.ToolStripPanelName = parent.Name;
                    }
                    else if ((parent.Parent is ToolStripContainer) && !string.IsNullOrEmpty(parent.Parent.Name))
                    {
                        this.ToolStripPanelName = parent.Parent.Name + "." + parent.Dock.ToString();
                    }
                }
                this.Visible   = toolStrip.Visible;
                this.Size      = toolStrip.Size;
                this.Location  = toolStrip.Location;
                this.Name      = toolStrip.Name;
                this.ItemOrder = ToolStripSettingsManager.GetItemOrder(toolStrip);
            }
Example #2
0
        /// <devdoc> 
        ///     Saves settings for the given form with the given settings key. 
        /// </devdoc>
        public static void SaveSettings(Form sourceForm, string key) {
            if (sourceForm == null) {
                throw new ArgumentNullException("sourceForm");
            }

            if (String.IsNullOrEmpty(key)) {
                throw new ArgumentNullException("key");
            }

            ToolStripSettingsManager settingsManager = new ToolStripSettingsManager(sourceForm, key); ;

            settingsManager.Save();
        }
Example #3
0
        /// <devdoc> 
        ///     Loads settings for the given Form with the given settings key. 
        /// </devdoc>
        public static void LoadSettings(Form targetForm, string key) {
            if (targetForm == null) {
                throw new ArgumentNullException("targetForm");
            }

            if (String.IsNullOrEmpty(key)) {
                throw new ArgumentNullException("key");
            }

            ToolStripSettingsManager settingsManager = new ToolStripSettingsManager(targetForm, key);

            settingsManager.Load();
        }