Provides data for a ViewEvent event that is raised when you click on a selected control or a designer region in a selected control. This class cannot be inherited.
Assembly: System.Design (in System.Design.dll)
Thetype exposes the following members.
|Equals(Object)||Determines whether the specified object is equal to the current object. (Inherited from Object.)|
|GetHashCode||Serves as the default hash function. (Inherited from Object.)|
|GetType||Gets the Type of the current instance. (Inherited from Object.)|
|ToString||Returns a string that represents the current object. (Inherited from Object.)|
The ViewEvent event is raised by the designer host for certain actions on a control on the design surface. For example, an event is raised when you click a selected control or a designer region in a selected control on the design surface.
The ControlDesigner class supplies a default delegate to handle the ViewEvent event. When you click a selected control or a designer region of a selected control at design time, the designer host initializes a ViewEventArgs object for a Click event type, and then sets the EventArgs property with a object.
When the ViewEventArgs object indicates that you clicked a designer region, the default delegate in the ControlDesigner class passes the object to the OnClick method. Classes deriving from the ControlDesigner class override the OnClick method to process events that are raised when you click a control in the design host.
For more information about events and delegates, see Events and Delegates.
The following code example shows how to use the to identify the region that was clicked and to change the view accordingly. This example is part of a larger example provided for the EditableDesignerRegion class.
' Handler for the Click event, which provides the region in the arguments. Protected Overrides Sub OnClick(ByVal e As DesignerRegionMouseEventArgs) If IsNothing(e.Region) Then Return End If ' If the clicked region is not a header, return If e.Region.Name.IndexOf("Header") <> 0 Then Return End If ' Switch the current view if required If e.Region.Name.Substring(6, 1) <> myControl.CurrentView.ToString() Then myControl.CurrentView = Integer.Parse(e.Region.Name.Substring(6, 1)) MyBase.UpdateDesignTimeHtml() End If End Sub