DefaultEventAttribute
is used to specify the default event for a component. The docs for Panel
(and presumably the other WinForms components) don't seem to show the value for the default event attribute, but if you look at the reference source (or decompile it yourself), you can see the value there:
[
ComVisible(true),
ClassInterface(ClassInterfaceType.AutoDispatch),
DefaultProperty("BorderStyle"),
DefaultEvent("Paint"),
Docking(DockingBehavior.Ask),
Designer("System.Windows.Forms.Design.PanelDesigner, " + AssemblyRef.SystemDesign),
SRDescription(SR.DescriptionPanel)
]
public class Panel : ScrollableControl {
I suppose the designers for each component pick the most frequently used event as the default, otherwise the base Control
class defines a default of Click
:
[
ComVisible(true),
ClassInterface(ClassInterfaceType.AutoDispatch),
DefaultProperty("Text"),
DefaultEvent("Click"),
Designer("System.Windows.Forms.Design.ControlDesigner, " + AssemblyRef.SystemDesign),
DesignerSerializer("System.Windows.Forms.Design.ControlCodeDomSerializer, " + AssemblyRef.SystemDesign, "System.ComponentModel.Design.Serialization.CodeDomSerializer, " + AssemblyRef.SystemDesign),
ToolboxItemFilter("System.Windows.Forms")
]
public partial class Control :