Home / Community & Support / Knowledge Base / RadControls for WinForms / Tools (VSB, Control Spy, Shape Editor) / Opening a control spy for a particular control using API

Opening a control spy for a particular control using API

Article Info

Rating: 5

 

Article information

Article relates to

 RadControls for WinForms

Created by

 Angel Kanchev, Telerik

Last modified

 January 24, 2007

Last modified by

 Angel Kanchev, Telerik


HOW-TO
Open the Rad Control Spy for a particular control or element by using code

SOLUTION
The spy form offers the needed API for setting a control or element to spy.

To set a control you can use the SetControlToSpy() method. Here is a sample code using an instance of RadToolStrip (RadToolStrip1):

RadControlspyForm spy = new RadControlspyForm();  
spy.SetControlToSpy(this.RadToolStrip1, true);  
spy.Show();  
 

The code above will open the ToolStrip with the whole tree expanded.

You can make the control spy to open a particular element if you wish. For this purpose you can use code similar to the following (myElement is the RadElement you wish to spy):

RadControlspyForm spy = new RadControlspyForm();  
spy.SetElementToSpy(myElement);  
spy.Show(); 

 

 

Comments

If you'd like to comment on this KB article, please, send us a Support Ticket.
Thank you!

Please Sign In to rate this article.