mikrogen wrote:
How can I determine if a user has clicked on the control in the designer? I would like to change my usercontrol appearance after clicking buttons in that usercontrol.
How can I react on dropping other controls onto my usercontrol? Is there any tutorial for that?
Hi mikrogen,
the best way is to derive your own class from
System.Windows.Forms.Design.ControlDesigner (add a reference to
System.Design.dll)
public class MyControlDesigner : System.Windows.Forms.Design.ControlDesigner
{
public override void OnPaintAdornments(PaintEventArgs e)
{
//Design time painting here
//Draw a rectangle around the control
}
}
and add this class to your custom control using the
System.ComponentModel.DesignerAttribute
[System.ComponentModel.Designer(typeof(MyNameSpace. MyControlDesigner))]
public class MyControl : Control
{
public override void OnPaint(object sender, PaintEventArgs e)
{
//Normal painting here
}
}
Tutorials are here:
http://www.divil.co.uk/net/articles/...troduction.asp http://www.howtodothings.com/showart...sp?article=706
Documentation (with examples):
http://msdn.microsoft.com/library/en...classtopic.asp
More info:
http://msdn.microsoft.com/library/en...imeSupport.asp
Cheers
Arne Janning