Académique Documents
Professionnel Documents
Culture Documents
http://msdn.microsoft.com/en-us/library/5ytx0z24
Note
The dialog boxes and menu commands you see might differ from those described in Help depending on your active settings or edition. To change your settings, choose Import and Export Settings on the Tools menu. For more information, see Working with Settings.
1 of 5
5/25/2012 11:39 AM
http://msdn.microsoft.com/en-us/library/5ytx0z24
2. Add a new UserControl item to the DebugControlLibrary project. For details, see How to: Add New Project Items. Give the new source file a base name of "DebugControl". 3. Using the Solution Explorer, delete the project's default control by deleting the code file with a base name of "UserControl1". For details, see How to: Remove, Delete, and Exclude Items. 4. Build the solution.
Checkpoint
At this point, you will be able to see your custom control in the Toolbox.
Private demoStringValue As String = Nothing <BrowsableAttribute(true)> Public Property DemoString() As String Get Return Me.demoStringValue End Get Set(ByVal value As String) Me.demoStringValue = value End Set End Property
private string demoStringValue = null; [Browsable(true)] public string DemoString { get { return this.demoStringValue; } set { demoStringValue = value; } }
2 of 5
5/25/2012 11:39 AM
Walkthrough: Debugging Custom Windows Forms Controls at Design Time 2. Build the solution.
http://msdn.microsoft.com/en-us/library/5ytx0z24
3 of 5
5/25/2012 11:39 AM
http://msdn.microsoft.com/en-us/library/5ytx0z24
The debugging instance has the Start button on its Debug toolbar disabled Your breakpoint is set in the debugging instance. 3. In the new instance of Visual Studio, open the "DebuggingExample" solution. You can easily find the solution by selecting Recent Projects from the File menu. The "DebuggingExample.sln" solution file will be listed as the most recently used file. 4. Open Form1 in the Forms Designer and select the DebugControl control. 5. Change the value of the DemoString property. Note that when you commit the change, the debugging instance of Visual Studio acquires focus and execution stops at your breakpoint. You can single-step through the property accessor just as your would any other code. 6. When you are finished with your debugging session, you can exit by dismissing the hosted instance of Visual Studio or by clicking the Stop Debugging button in the debugging instance.
Next Steps
Now that you can debug your custom controls at design time, there are many possibilities for expanding your control's interaction with the Visual Studio IDE. You can use the DesignMode property of the Component class to write code that will only execute at design time. For details, see DesignMode. There are several attributes you can apply to your control's properties to manipulate your custom control's interaction with the designer. You can find these attributes in the System.ComponentModel namespace. You can write a custom designer for your custom control. This gives you complete control over the design experience using the extensible designer infrastructure exposed by Visual Studio. For details, see Walkthrough: Creating a Windows Forms Control That Takes Advantage of Visual Studio Design-Time Features.
See Also
Tasks Walkthrough: Creating a Windows Forms Control That Takes Advantage of Visual Studio Design-Time Features How to: Access Design-Time Services How to: Access Design-Time Support in Windows Forms
Yes
No
Community Content
4 of 5
5/25/2012 11:39 AM
http://msdn.microsoft.com/en-us/library/5ytx0z24
Correction
The path to Visual Studio 2010 is "%programfiles%\Microsoft Visual Studio 10.0\Common7 \IDE\devenv.exe" 1/31/2012 TSchoening
5 of 5
5/25/2012 11:39 AM