Advertisement
Guest User

selfelected

a guest
Feb 4th, 2010
858
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.68 KB | None | 0 0
  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. }
  37.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement