SHARE
TWEET

selfelected

a guest Feb 4th, 2010 799 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. public partial class MyAppForm : System.Windows.Forms.Form
  2. {
  3. protected new bool DesignMode
  4. {
  5. get
  6. {
  7. return HelperMethods.IsDesignMode(this);
  8. }
  9. }
  10. }
  11.  
  12.  
  13.  
  14. public partial class MyAppUserControl : UserControl
  15. {
  16. protected new bool DesignMode
  17. {
  18. get
  19. {
  20. return HelperMethods.IsDesignMode(this);
  21. }
  22. }
  23. }
  24.  
  25.  
  26. class HelperMethods
  27. {
  28. public static bool IsDesignMode(System.ComponentModel.Component x)
  29. {
  30. var site = x as System.ComponentModel.ISite;
  31. return
  32. ( null == site ? false : site.DesignMode ) ||
  33. System.ComponentModel.LicenseManager.UsageMode == System.ComponentModel.LicenseUsageMode.Designtime ||
  34. System.Diagnostics.Process.GetCurrentProcess().ProcessName == "devenv";
  35. }
  36. }
RAW Paste Data
Top