cs窗体继承问题界面打不开和添加自定义控件设计器报错
父窗体
必须要有无参构造构造函数
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; }
添加自定义控件设计器报错
if (DesignMode || !IsHandleCreated) return;