We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

VStudio Form Designer Detection

Does anyone know how to test (with C# code) when the VStudio form designer may be rendering the code? I've got some logging functions that I'd rather not have to keep commenting out whenever I want to revert back to using the form designer. TIA, -Roy

3 Replies

RM Roy Muller November 5, 2002 11:49 AM UTC

I also posted this in microsoft.public.vsnet.ide and received an excellent response from Xin Huang who appears to be from Microsoft. This was his reply: +++++++++++++++++++ When VS.NET starts editing a component in the designer, the ComponentDesigner.Initialize method is called by the root designer. This is the time at which you can tell the component that it is running inside VS.NET designer by setting an internal flag. Depending on this flag, you can decide whether to enable the logging functions. Of course, this requires that you derive a designer for the component. See for more information about custom designers. Regards, Xin This posting is provided "AS IS" with no warranties, and confers no rights. You assume all risk for your use. (c) 2002 Microsoft Corporation. All rights reserved.

RM Roy Muller November 5, 2002 06:57 PM UTC

It seems the URL from Xin's reply was stripped out of my previous post. Also, the subject matter is a bit intimidating for me right now; I need to re-read the article a few times before I try to subclass my own designer ;-) Here's the URL that was stripped: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/custdsgnrdotnet.asp -Roy

PS Prakash S Syncfusion Team November 12, 2002 03:01 PM UTC

Can you not use the Component.DesignMode property? Prakash

Live Chat Icon For mobile
Up arrow icon