WinForm Control Development Summary (11) Debugging control design-time behavior

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.