c# - Are there any caveats to swapping out DesignMode for LicenseManager.UsageMode in a WinForms UserControl constructor? -
If you have a form that displays data, then you can do a thing which reference I just got a comment on a blog post that starts fixing it, but it gives context to the class's functionality as a replacement that works as expected in a UserControl. Then I can do a UserControl for: this. DesignMode In the Constructor to avoid populating it in Designer:
Public Partial Category SetupForm: Form {Private Setup Container Container = New Setup Item Container (); Public Setup Form () {InitializeComponent (); If (! This.DesignMode) {this.bindingSource1.DataSource = this.container; This.Fill (); However, if you decide to write that form again as a user control, keeping the same constructor logic, something is unpredictable -
this.DesignMode is always lies no matter Does it go to the designer to apply your logic, which means runtime.
Public Partial Category AffiliateSetup: UserControl {Private AffiliateItemContainer Container = New AffiliateItemContainer (); Public AffiliateSetup () {InitializeComponent (); If (LicenseManager.UsageMode == LicenseUsageMode.Runtime) {this.bindingSource1.DataSource = this.container; This.Fill (); Instead of using
DesignMode , there are any warnings or implications that can be sent to me in my production code, instead of using
Pause
OnPaint method.
Comments
Post a Comment