Some of the previous articles are to talk about the design of the control behavior, since there are so many design-time behavior of the code to write, then it is necessary on how to debug the design behavior of the control.
Debugging a control's design-time behavior is very similar to debugging a DLL, because DLLs cannot be run separately, and generic controls are in one DLL. Of course, if you do not consider the reusability of the class and write the control in a Windows application inside is understandable, so debugging is also easy to change. But we still have to consider the more common situation. In general, when we debug a DLL, we create an independently running application that references the DLL project you want to debug, sets breakpoints in the DLL engineering code, and then debugging. So, the first problem with debugging this kind of thing is to find a host that calls it. Debugging the design-time behavior of a control what kind of host is best, of course, is Visual Studio, and Visual Studio offers very comprehensive design-time support. Come down and I'll show you how it's done.
First, set the project you want to test for startup engineering. In Solution Explorer right click on the project where the control is located, select Attributes (Properties) in the menu to enter the project properties settings interface, click on the "Debug" page, the start Action selected as "Start External program", Next click on the selection button to select your Visual Studio executable program, my Visual Studio program is located in the D:\Program Files\Microsoft Visual Studio 8\common7\ide\ Devenv.exe ", you can choose according to your own situation. The following figure:
After setting the engineering properties, set breakpoints where you want to debug, then click F5 or click the toolbar's Run button. When clicked, Visual Studio will run and open a project with your assembly in the running Visual Studio, switch to the Form designer interface in this project, select your controls, and edit the features you want to tune, such as To debug the editor of a control's properties, you set a breakpoint in the editor class, and then edit the property in the property browser, and the program stops at the breakpoint you set.
Today, I also write the previous article used in the source code attached to facilitate the use of friends.
This article supporting source code: http://www.bianceng.net/dotnet/201212/783.htm