public interface cccFormExtensionInterface { cccFormExtensions FormExtensions{ get; set; } }I then defined an object thusly (abreviated here):
public class cccFormExtensions { //private System.Configuration.ApplicationSettingsBase _settings; private Settings FormSettings = new Settings(); private mmBaseForm ParentForm; //public cccFormExtensions( mmBaseForm parentForm, System.Configuration.ApplicationSettingsBase s ) public cccFormExtensions(mmBaseForm parentForm) { ParentForm = parentForm; this.OnLoad(); } private Settings appSettings { get { return FormSettings; } set { } } public void OnLoad() { FormSettings.SettingsKey = ParentForm.Name; if (! FormSettings.WindowSize.IsEmpty) { ParentForm.Size = FormSettings.WindowSize; }; ParentForm.Location = FormSettings.WindowLocation; ParentForm.WindowState = FormSettings.WindowState; } public void OnClosing() { FormSettings.WindowState = ParentForm.WindowState; ParentForm.WindowState = FormWindowState.Normal; FormSettings.WindowLocation = ParentForm.Location; FormSettings.WindowSize = ParentForm.Size; FormSettings.Save(); } }Finally for each MM form that I wanted to add these feature to, I created a subclass such as:
public partial class cccBusinessForm : mmBusinessForm, cccFormExtensionInterface { private cccFormExtensions _FormExtensions; public cccFormExtensions FormExtensions { get { return _FormExtensions; } set { _FormExtensions = value; } } /// <summary> /// Constructor /// </summary> public cccBusinessForm() { InitializeComponent(); } private void cccBusinessForm_Load(object sender, EventArgs e) { FormExtensions = new cccFormExtensions(this); } private void cccBusinessForm_FormClosing(object sender, FormClosingEventArgs e) { FormExtensions.OnClosing(); } }Well, there it is. Is there a better/easier way to accomplish this that I'm not seeing? Am I overlooking some pitfall?