winfrom定制用户控件时,有时拖到工具栏时会报错
C# winfrom定制用户控件时,有时拖到工具栏时会报错,但add进去不报错,可在控件Load事件加入如下代码,就可:
if (!(this.GetService(typeof(IDesignerHost)) != null || System.ComponentModel.LicenseManager.UsageMode == System.ComponentModel.LicenseUsageMode.Designtime))
{
}