Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public partial class MyAppForm : System.Windows.Forms.Form
- {
- protected new bool DesignMode
- {
- get
- {
- return HelperMethods.IsDesignMode(this);
- }
- }
- }
- public partial class MyAppUserControl : UserControl
- {
- protected new bool DesignMode
- {
- get
- {
- return HelperMethods.IsDesignMode(this);
- }
- }
- }
- class HelperMethods
- {
- public static bool IsDesignMode(System.ComponentModel.Component x)
- {
- var site = x as System.ComponentModel.ISite;
- return
- ( null == site ? false : site.DesignMode ) ||
- System.ComponentModel.LicenseManager.UsageMode == System.ComponentModel.LicenseUsageMode.Designtime ||
- System.Diagnostics.Process.GetCurrentProcess().ProcessName == "devenv";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement