I have a custom control that I have written that does some location checking in the Load event of the control. This location checking moves the control to a specific location on the screen based on settings in its parent control. This code works as expected when I compile and run the application.
However, when using the Visual Studio designer, it causes my control to be painted outside of the viewable area and I cannot use the designer. Is there a flag or attribute I can set to stop that snippet of code from running ONLY when in the Visual Studio designer?
The only work around I have right now is to comment out the code, compile, launch designer, make my changes, then uncomment the code and re-compile.
You could check the value of LicenseManager.UsageMode
.
if (LicenseManager.UsageMode == LicenseUsageMode.Runtime)
{
// Code here won't run in Visual Studio designer
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With