父窗体
必须要有无参构造构造函数
load方法里
if (!DesignMode) //是否是设计模式 { Init(); }
if (!(GetService(typeof(IDesignerHost)) != null || LicenseManager.UsageMode == LicenseUsageMode.Designtime) || !this.DesignMode) { Init(); }
子窗体
//public frmBaseFastInputWeight() : base() //{ // InitializeComponent(); //} public frmBaseFastInputWeight(FastInputViewModel fastInputViewModel) : base(fastInputViewModel) { InitializeComponent(); _fastInputViewModel = fastInputViewModel; }
原文:https://www.cnblogs.com/shuaimeng/p/14242671.html