public virtual void OnSiteChanged() { HelpProvider hp = this.Site.GetService(typeof(HelpProvider)) as HelpProvider; HelpService hs = this.Site.GetService(typeof(HelpService)) as HelpService; if (hp != null && hs.DynamicHelpEnabled) { hp.HelpNamespace = hs.FindHelp; } this.SuspendLayout(); _settings = (Settings)this.Site.GetService(typeof(Settings)); SetCheckBoxValue(this.checkBoxXPath, "SearchXPath"); SetCheckBoxValue(this.checkBoxWholeWord, "SearchWholeWord"); SetCheckBoxValue(this.checkBoxRegex, "SearchRegex"); SetCheckBoxValue(this.checkBoxMatchCase, "SearchMatchCase"); _recentFindStrings.SetValues(this._settings["RecentFindStrings"] as string[]); _recentReplaceStrings.SetValues(this._settings["RecentReplaceStrings"] as string[]); Size s = this.ClientSize; object o = this._settings["FindMode"]; if (o != null) { this._findOnly = (bool)o; SetFindModeControls(!this._findOnly); } object size = this._settings["SearchSize"]; if (size != null && (Size)size != Size.Empty) { Size cs = (Size)size; s = new Size(cs.Width, cs.Height); } this.ClientSize = s; object location = this._settings["SearchWindowLocation"]; if (location != null && (Point)location != Point.Empty) { Control ctrl = this.Site as Control; if (ctrl != null) { Rectangle ownerBounds = ctrl.TopLevelControl.Bounds; if (IsSameScreen((Point)location, ownerBounds)) { this.Location = (Point)location; } else { this.Location = CenterPosition(ownerBounds); } this.StartPosition = FormStartPosition.Manual; } } this.ResumeLayout(); }