When you Double-Click on a Control
in the Visual Studio Designer, you automatically subscribe to some event
and an Event Handler is generated in th
If wanting to do this in the editor.
For VS2017 (and beyond I suspect). In Designer:
This also works for deleting the auto-generated code. Remove the name of the event handler for that event. It will get removed from the *.designer.cs file. Note that you still need to remove the handler code in the form source.
There is a DefaultEventAttribute that controls can specify. The designer knows to read this attribute and uses it to determine which event to use as the default.
[DefaultEvent("DoubleClick")]
public class MyClass {
public event EventHandler DoubleClick;
}
There is also a DefaultPropertyAttribute which is significantly less useful. It just determines the default property name to select in the property grid when the control is selected in the designer.